Hello!
I don't know if the title fits to what I'd like to learn. I really need your help because I'm stuck with something that should work and I start getting crazy... <img src="smileys/smiley12.gif" border="0" align="middle">
Here is the gameplay loop of my game (it is a old test version -but fonctional- but you'll be able to figure out what the game is about and what I'd like to do).
http://dl.dropbox.com/u/63083711/index.html
The physical objets I mentioned are randomly generated from the bottom of the screen, every X frames. In the example above, they are not animated and... I want them to be animated and keep their circle collision.
Ashley recommended me to spawn a physical object (invisible) using the collision and put the animated sprite over it (creating the illusion that the animated sprite itself has the circle collision).
So everytime I spawn a physical objet, I need to link to it its visual aspect. In theory, nothing really complicated but I can't make it work even if that's what I did with the dropped balls. This time I must have done something wrong and I get too angry to see what...
- First, I create the physical objet. I give it an ID (taken from a enemy counter, a global variable called IDEnemy01Count, increased each time a new enemy is spawned in order to make it unique... I could use the IID but it doesn't work either, I suppose the problem doesn't come from there).
- Then I spawn on it the visual aspect. I give it an ID, the same than the physical objet, in order to create a link between both.
- and... it's a mess: the very first spawned object and its visual aspect move as they should do, and once the second physical objet is spawned, all the visual aspects just... stop and don't follow the physical objects.
Here is the code I use:
<img src="http://dl.dropbox.com/u/63083711/screenshots/enemies01a.png" border="0">
<img src="http://dl.dropbox.com/u/63083711/screenshots/enemies01b.png" border="0">
<img src="http://dl.dropbox.com/u/63083711/screenshots/enemies02.png" border="0">
As I said, that's how I proceed with the dropped balls (it's a physical objet with a visual aspect over it), but I don't know why... in this case, it worked :o
Seriously, that's something that made me crazy for hours recently, I may have missed something obvious, simple and stupid... but maybe I just don't know how to identity an objet among other similar, after having spawned them "generically". If I could master that kind of things, everything would be easier...
Thanks in advance.
Rag'
PS: I may be unclear in my explanations... If so, please don't hesitate to ask questions in order to identify what's wrong. I really need to make it work <img src="smileys/smiley19.gif" border="0" align="middle">