Hello,
I saw a .capx in the FAQ and few posts about how to make the slash effect from Fruit Ninja. But I didn't find anything helpful for generating the fruits. So I tried to make one and if you can help me fix it then maybe it can be added to the FAQ.
Here is the dropbox link.
dl.dropboxusercontent.com/u/19981154/fn.capx
What does it do?
1. Updates the variable Random_int every tick.
2. Every y seconds, if Random_int is above a constant threshold then create a new fruit below the canvas.
3. The x-coordinate origin point of the new fruit is randomized using choose().
4. Hit each new fruit with an upward impulse. The impulse is randomized by choose() so the flight paths are different.
5. Fruit is destroyed if it falls below a certain y-coordinate.
Problems and Questions (need your help):
1. The fruits are spinning like crazy. I have set Angular Damping to 1 but they are still spinning too fast. I found an alternative: set Prevent Rotation to 1 and faking the rotation by setting Angular Velocity. But I rather figure out how to rotate using impulse.
2. How do I disable collision? I don't want the fruit to run into each other.
3. Changing the size of the sprite and collision box changes the mass, which requires adjusting the size of the impulse through trial and error. Otherwise the fruit just flies off the screen or goes no where. Is there another way to determine the impulse strength?
4. I care about performance because I want to release this game on mobile devices. Is there a more optimized way to create and destroy the fruit? Better way to randomize the fruits' origins?
Thank You,
K