Mass* Acceleration = Damage?

0 favourites
  • 6 posts
From the Asset Store
This sound pack features 117 game sounds : Axe,Punch Swing & Hit & Damage. This is a perfect collection for your game.
  • Hi. I need to do a type of F=M*A equation to calculate damage for my character (or perhaps something a little simpler) and I'm having a bit of trouble with it. This is what I have working:

    ((Building.Physics.Mass * (abs(Building.Physics.VelocityX) +abs(Building.Physics.VelocityY))) * 0.008)

    This works pretty well, except that if you are standing on something that happens to be moving fast (like driving a car or riding a skateboard), it will kill you...

    Can anyone help me out with a better equation?

  • Have it check the difference between the speeds of the two objects. Therefor if you check player speed and skateboard speed, you can tell them game "The difference is 1mph" and the game goes "skateboard can't kill/dmg due to insufficient relative force"

  • so would it be something like this?

    abs((total player velocity) - (total object velocity)*mass) = damage

  • I am going to have to do a tutorial over this. Seen it pop up a couple of times recently. I had this exact question a while ago:

    Here is a demo of rocks smashing into each other in space using the momentum forumla to figure out relative damage based on velocity and mass: Demo

    And here's the capx (r120.2). Basically, you want to add each object's x velocity and y velocities together, then add those two results together to get a relative velocity. Since that velocity can be negative, you take the abs of that relative velocity and use it with the mass of the object to get your momentum. After that, you decide how much damage each unit of momentum is worth and wreak havoc.

  • Thank you, but it doesn't seem like this formula compares the direction of the forces, in which case, if two asteroids are moving very fast together in a similar direction they touch slightly, they take the same amount of damage as if they rammed head on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My wording was a little off in my post, the capx has it correct.

    You actually subtract the two X and two Y velocities.

    So, given:

    Object 1: Vx=10, Vy=0

    Object 2: Vx=11, Vy=1

    You would get:

    abs((10-11) + (0-1))

    abs(-1+-1)

    abs(-2)

    Relative Velocity of 2

    Sorry about the confusion in the post itself. It's really late/early here.

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