How to slow down physics

Get help using Construct 2

Post » Sat Apr 07, 2012 12:55 pm

Hey guys,

If this has been asked and answered before - I could not find it.

I'm making a game where a cannon shoots a cannon ball to destroy some enemies ("gorilla.bas" style if you remember that one).

Using physics and solids.

On button click, I'm having the cannon spawn a cannon ball. Then I apply impulse to the cannon ball at an angle. So far so good. The cannon fires the ball and it goes hit the enemy, describing an arc (due to gravity). Perfect.

I'm very happy with it so far except one thing: I would like the cannon ball to go slower. It goes too fast. If I half the ball density and the impulse, or double them, he speed is the same (of course). I want some slow motion effect on the cannon ball movement.

How can I achieve this effect?

Thanks!
B
14
S
5
G
7
Posts: 235
Reputation: 5,175

Post » Sat Apr 07, 2012 2:20 pm

Perhaps use the bullet behaviour instead of physics. You can then control initial speed, acceleration/retardation and gravity, plus others
B
31
S
11
G
7
Posts: 197
Reputation: 6,682

Post » Sat Apr 07, 2012 2:24 pm

Instead of touching the physics, half the timescale for the duration of the shoot.

It will give a slowdown effect by slowing stretching up the time in your game, should do the trick.

Also, gravity might have an effect on the speed of your cannon ball, but it will surely have some effect on the trajectory too.

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Sat Apr 07, 2012 10:54 pm

@AndyWatson bullet won't do, I want it to rise and fall, like a cannon ball would. @Kyatric's suggestion did the trick, thanks!

Funny thing though (and unexpected, probably a bug), the trajectory isn't exactly the same when the timescale is 0.5. I have the cannon firing and collision with the enemy event, with same coordinates, angle, impulse etc (same everything). It hits the enemy when timescale is 1, and it misses it by very little when it's 0.5.

It doesn't matter much though, all projectiles will fire at half time scale so nobody will notice.

Cheers, and thanks again.
B
14
S
5
G
7
Posts: 235
Reputation: 5,175

Post » Sat Apr 07, 2012 11:10 pm

No worries, tho i use bullet with grav in my games to fire sprites on a trajectory. There are many ways to make things work in c2 and that's its genius!
B
31
S
11
G
7
Posts: 197
Reputation: 6,682


Return to How do I....?

Who is online

Users browsing this forum: Rezzon71, tarek2 and 24 guests