How do I make a grenade to stop bouncing?

Get help using Construct 2

Post » Wed Aug 03, 2016 10:10 pm

Hello, that's my first time posting here.

I have 2d platformer game, where player throws grenade which is physics + bullet behaviour used.
Grenade destination is described by position of the mouse.
When grenade is touching the ground I want it to bounce 1-2-3 times and then to stop bouncing or just immobilize it. Everything is working but...
The problem is when the grenade bounces more than 5 times - it stats to bounce super fast forever. It never stops.
Also when player aims the ground it's speed increases greatly.
I'm trying different types of physic settings like elasticy or friction but there's no difference.
Forcing grenade to stop by setting bullet speed to 0 doesn't help too.
Here's the video how it looks like now. http://sendvid.com/5qsvmsrw
I want it to behave like a grenade known from "Worms armageddon" nades :) Is it even possible?
B
6
S
2
Posts: 4
Reputation: 527

Post » Thu Aug 04, 2016 12:21 am

Here is an example I made for someone else's problem previously - https://www.dropbox.com/s/6cliwidu8f51p ... .capx?dl=0

It doesn't use physics, but may give you an idea.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

Post » Thu Aug 04, 2016 1:13 am

A few points to note

-The reason why it appears to be faster when you aim at the ground is because its not directly fighting against the world gravity...

-Friction only affects objects when they are touching another physics object

-Elasticity only affects how high objects bounce when hitting the floor.

-Physics Iterations property will affect behavior like bouncing

you could also just add a timer that triggers after the first bounce...which then radically adjusts either

-the physics density for each grenade

-Linear damping -The rate the object slows down over time while moving ( would suggest this is better)

and/or
-turns off the physics after a certain amount of time or even better, triggers its "immovable" Property as long as you test for it being at rest on the Ground
so it doesn't appear as a glitch

also i assume the grenade is supposed to explode...Your video doesnt show this but normally a Grenade explodes either on contact or after a delay
Shouldn't either of these actions cancel out the constant bouncing due to the fact of the grenade destroyed?
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Post » Thu Aug 04, 2016 4:00 am

Also, moving physics objects using other behaviours (like bullet for example) can also cause weird results. It is recommended when using physics to only move the objects by applying forces - and not using "set speed" or "set angle" etc from other behaviours. Usually the option of having two or more behaviours is if you want to move the object sometimes by physics, and other times not.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Thu Aug 04, 2016 2:31 pm

Hey, oosyrag you saved the day! Other responses were also helpful. Thanks guys, grenade works as intended.
Here's how it looks now: http://sendvid.com/t48nb8yg
B
6
S
2
Posts: 4
Reputation: 527


Return to How do I....?

Who is online

Users browsing this forum: minigame and 8 guests