Simple bouncy ball example? (No Physics)

0 favourites
  • 5 posts
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • I made a bouncy ball with the bullet behavior (increase gravity, bounce off solids, etc.) but it's kind of buggy and bounces the wrong way near corners. I'd like to just make one using events but I'm awful at this sort of thing. Anyone mind making or sharing a simple bouncy ball example?

  • Tokinsom no physic only bullets

  • As I said, the bullet behavior is too buggy for this. It doesn't handle corners well and occasionally bounces in the wrong direction.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You ask for bullet behaviour and not Physics. If you wish to have corner and more then you physic or work out proper coordinate which I don't have time for. Thank you anyway. I tried

  • Tokinsom

    I made this one recently, but corner bouncing can be a bit odd.

    The idea was to try to move horizontally then vertically. So first move the ball horizontally and if it then is overlapping a wall move out of the wall and invert the x velocity. To simplify moving out of the wall I just moved the ball back to it's x position before it moved, which looks good enough. The same is then done in the vertical direction.

    Overall it works great for horizontal and vertical walls, but as I said corner bouncing still can look odd. For more accurate corner bouncing we need to find what the ball hit first, a corner or an edge.

    Attached is another capx example. To make the bounces even more accurate we just need to improve the normal detecting events. The only complicated looking math is in event 11 when speed_along_normal is set. It's doing a vector dot product which gives us the speed in a certain direction. One thing you can do is check if the ball is touching a corner by seeing if the distance between the ball and a corner is near the radius, then in that case the normal would be the angle from the corner to the ball.

    Anyways just some ideas.

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