Discuz! Board

 

 

Search
Discuz! Board Forum Integration Questions lol for the love of christ how do i get rid of a spr ...
View: 509|Reply: 7
go

lol for the love of christ how do i get rid of a sprite

Rank: 2

Post on 2011-9-16 00:39 |All posts
tried everything that made sense to me as well as things that dont. i tried scene.remove(spritename), spritename.remove(); remove(spritename);

various results, some resulted in the sprite not moving, the scene.remove version deleted the whole scene, turned it black and restarted the game... i apparently cant figure it out :p

also im finding the inability to access functions and variables in between imported scripts very difficult to do anything to the point where now i !i just want to use one file because its so much of a convoluted hassle! any advice would be helpful!

Rank: 2

Post on 2011-9-16 01:20 |All posts
ok, i sorta got it to work remove from parent... for single objects... now the problem is that i have my enemies setup as an array, and those wont remove, dont know what to do...

Rank: 1

Post on 2011-9-16 10:40 |All posts
Reply lostclimategame 's thread

just  invoke removefromparent for each sprite

Rank: 2

Post on 2011-9-17 01:07 |All posts
i figured it out, it was the way i was creating the array. the manual makes it sound like
var foo = new Array(2);

should create a new array with 2 elements... that doesnt even compile right, when i was having the problem it was compiling before it was somehow bcs i forgot the ;. when i saw that i figured out a way to make it work using a sort of dirty hack but im curious... how do i init an empty array with x, or even 0 elements?

right now im just using
var foo = [x,x];
but i dont really want to have to immediately define the elements, i want the engine to dynamically update them as my enemy list.

Rank: 2

Post on 2011-9-17 12:39 |All posts
hmm, ran into a new place i need an empty array for, any help?

Rank: 4

Post on 2011-9-20 01:04 |All posts
var a = new Array()

Rank: 2

Post on 2011-9-20 17:49 |All posts
the problem is that i have my enemies setup as an array

Rank: 2

Post on 2011-9-21 01:57 |All posts
hey friendlinzh, i got everything figured out for it. do you need any help?
Security Q&A Change Security code Change

Archiver|Comsenz Inc.

All time is GMT+8, 2013-5-19 00:37 , Processed in 0.033169 second(s), 10 queries .

Powered by Discuz! X1.5

© 2001-2010 Comsenz Inc.