Following scenario:
I want to move enemy from right to left on the screen.
Enemy has physics body attached to it, so I can detect collision with hero or bullets.
How should I move the enemy?
- By setting its x/y coordinates in game loop (enterFrame event handler)?
- By setting its linear velocity?
What’s the preferred way?
I thought moving display objects being active in physics world by setting their x/y coordinates is wrong, because it causes some conflicts with the physics engine. Is this right?
If so, and the preferred option is using the 2., how do you move enemy that shouldn’t move on straight line, but on curved trajectory instead - e.g. sine function? In such case, I don’t know how I could use option 2. at all.