How do I make a grenade to stop bouncing?

0 favourites
  • 5 posts
From the Asset Store
Bouncing ball
$9.99 USD
Template for a bouncing ball game, fully documented in comments and video
  • 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 <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> Is it even possible?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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?

  • 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

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)