I am creating a Game similar to Fruit Ninja and I need some help regarding random motion of fruits in my game. I already created the slice effect, but there is no random motion of sprites.
|
closed as not a real question by Byte56, Sean Middleditch, bummzack, Tetrad♦ Mar 15 at 23:46
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
|
I would start by generating the random starting position of the item. This should be off-screen, which can be handled with a simple set of nested Next I would generate a random direction on the screen. To make sure it will shoot onto the screen, find a random position on the screen and calculate the direction ( Once you have a position and direction, then you just need to give the objects a velocity proportional to the direction vector. Every frame you will decrease the This is a fairly simple algorithm, although you might need to change the target point, specifically changing the |
|||
|
|
