Physics question on spinning and collisions

Get help using Construct 2

Post » Thu Dec 05, 2013 11:18 pm

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.

https://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,
KKiratTheKop2013-12-06 03:13:47
B
11
S
2
Posts: 68
Reputation: 982

Post » Fri Dec 06, 2013 7:09 am

Let me rephrase the question:

1. How do I prevent the sprites from spinning so fast?

2. How can I prevent the sprites from colliding with each other?
B
11
S
2
Posts: 68
Reputation: 982

Post » Fri Dec 06, 2013 7:59 am

You could choose not to use physics (If you want to play on mobile this is alkmost always the best choice)

I would:
Make a fruitbox (invisible sprite to pin the fruit on)
give it bullet behaviour and turn on gravity for the behaviour.
Pin the fruit on the fruitbox (position only)
give the fruit sine behaviour to spin it.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: MassimoF, Microbex and 23 guests