How do I determine speed when dealing with angular movement with physics

  • I'm trying to do a pong type game with a ball bouncing around and make it move faster over time but i need to throttle it at some point.. to do this it seems like there has to be a way to determine it's directional speed at any given angle..

    Then once we know what the speed is, figure out how to insure it doesn't go over a certain speed otherwise it just gets infinitely faster. It would seem like it should be fairly easy but I've found it to be very elusive to get something to work.

    Thanks,

    Caleb

  • speed = distance(0, 0, Sprite.Physics.velocityX, Sprite.Physics.velocityY)

  • that's awesome I'm going to tackle this soon! I can't wait to try it out.

    Thanks,

    Caleb

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ok that worked like a charm! very useful. the only other question i have for speed is how could you then throttle the speed to not keep getting faster.. as you can imagine in a zero gravity game any bounce gets faster and faster. trying to keep it in check. some kind of max speed.

  • You can change velocity with events too. For example, if overall speed is N times greater than maximum speed, set velocity X component to Self.Physics.VelocityX/N, and Y component to Self.Physics.VelocityY/N

  • very interesting. that does make sense, although I'd not have guessed that myself.

    I'm going to see if i can apply that today. You're the best! :)

    Thanks!

    Caleb

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