This content has been marked as final. Show 4 replies
One option is, as long as the y coordinate at which the asteroid emerges and disappears is different to the y position at the point at which it moves across the front of the planet (elliptical), you can cut the picture of the asteroid in two (horizontally) and put one half below the asteroid and one half above it (depth-wise). You have to get the asteroid to do the ellipse though, or it won't work.
Does this make sense? Draw it and you'll see what I mean.
You could use two planets at the same coordinates and a hit test to determine which one to make visible when, but I'm not sure this will offer any improvement, and it's more difficult to implement in AS2.
here's one solution in AS3:
this code is using your basic spring force to simulate the spinning. Then it checks for a change in direction to swap the z-positions of the planet and the asteroid.
Thanks knew-bie.. but maybe nextYear i will start with A.S. 3.0
I am buidling a flash space game for fun in ActionScript 2.0
But i think i will skip the astroids moving around a planet becasue
i don't know in actionscript to move an object in a eptical motion..
But if someone has done this before let me know please!
If the game is finished everybody on this forum can play it :)
Oh, i must be blind.. all the code i need is in your script!
I already changed it to A.S. 2.0 and it worked :) Thanks !