|
I have a world set up with edges corresponding to the edges of the screen on a phone. The boundaries are a closed rectangle of dimensions 320x480 where (0,0) is the bottom left corner.
I have an enemy that is a ball that I want to move from off screen to on screen in a smooth motion. However, I want to maintain accurate collisions with the enemies that are already on screen. For example, when the enemy ball is transitioning to on screen and it is only half way on screen, I want the enemies that are already present to bounce off of it as if it were a half circle.
What I am doing now is to create a static body at some point off screen (say (-100, 100)) and on my update I increment the x position of the ball until it is at some point on screen (say (100, 100))
But what happens is the physics engine recognizes the ball is on an edge and "squeezes" the ball into the physics world. Basically, I just want this body to ignore walls for a period of time until it is fully on screen and then I want it to adhere to the edges as it normally would.
I hope this makes sense. If it helps, think of a pin ball game where you pull a lever back and launch a ball into the game.
|