Making more realistic falling?

This forum is currently in read-only mode.
From the Asset Store
In 2D realistic stones are included high quality realistic 18 stones/rocks.
  • Hi, My gravity I'm using right now is a bit straight and I'm wanting to make it more realistic?

    http://www.mediafire.com/?bce2wmtjwmj

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, first off... I just took a closer look at your .cap to see what was going on. That movement system is a mess. You're setting your sprites to absolute coordinates on the screen each cycle... that's a really inefficient way to do it.

    Instead of an absolute "Set Y to value('height')" you should be doing something like a relative "Set Y to Y + 7" when it's falling.

    For some tips on making custom gravity and such, I suggest you check out vinnie's Custom Platform Movement thread here:

    http://scirra.com/phpBB2/viewtopic.php?t=613

    Anyway, to do acceleration you need to add more to the falling rate every cycle. For instance, on the first tick you'd make the thing move 1px down. Next you'd make it move 2px down. Then four, etc. It all depends on the rate you want. It's best to make a separate variable for acceleration so you can tweak it easily. Those are the basics.

    So, in pseudocode:

    + Object is not on a platform
      - Set value('status') to "falling"
    
    + Object value('status') Equal to "falling"
    + Object value('fallSpeed') Less than 8
      - Add value('gravityAccel') to value('fallSpeed')
      - Set Object Y to Y + (value('fallSpeed') * TimeDelta)
    [/code:3ax13xma]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)