Getting started - weird physics

  • Hi all,

    Just getting started here. I have put myself on a basic attempt to make a test game.

    What I am trying to accomplish here is to create a single screen game with a bouncing enemy.

    A vertical rotating ray will be the enemy boss, and the player must avoid it.

    The boss will constantly bounce off the screen edges.

    I have 4 invisible walls at the edges, and I can do an initial push on the boss. It has 0 friction, 0 gravity and 1 elasticiy, I think this would mean the boss should bounce infinitely on the edge walls with perfect conservation of energy.

    That is not what I am seeing though. The boss bounces off at weird angles, sometimes slides on edges, loses speed, and sometimes crosses through the walls and goes off screen.

    Also, I cannot reliably read the boss's velocity.

    The problem probably exists between the chair and the keyboard, can anyone help?

    Many thanks!

    https://1drv.ms/u/s!ArcXERob0wJkg61F2Ywf-SgVRE5f1Q?e=0H4uuB

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Don't use Physics together with other non-physics movement behaviors like MoveTo and Rotate, they are not compatible and will be conflicting with each other, causing weird bugs.

    I made some changes to your project, take a look:

    dropbox.com/s/r270h45hgrifpxs/bouncyboss.c3p

    Pay attention to collision polygons, the polygon on Boss sprite was completely messed up.

    Because the boss is a line it doesn't reflect from walls well.

    You can try to further improve this by adjusting reflection angles, for example using raycasting feature of the Line Of Sight behavior. Before the collision with walls, cast a ray, save its reflection angle in a variable. On collision use this saved reflection angle value to set new velocity x and y. But it may be a difficult task, since the boss can hit two different walls with its two ends...

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