Bouncing Enemies That Change Directions

This forum is currently in read-only mode.
From the Asset Store
Bouncing ball
$9.99 USD
Template for a bouncing ball game, fully documented in comments and video
  • I can't get this to work. If I try to rotate they get stuck/bounce off at random angles from the things they bounce off, if I try setangle they get stuck on the second bounce after working correctly the first time. I just want enemies that bounce back and forth and change direction every time they bounce.

    dropbox link to .cap file here:

  • I did update the cap but noticed yours was saved in an earlier version so here's some code instead (only replace the collision event, I only added the private variable test so you could recognise where I mean)....


    On collision between enemy1 and terrain

    enemy1: Value 'Right' Equal to 1

    On collision between enemy1 and terrain

    enemy1: Value 'Left' Equal to 1


    enemy1: overlaps Terrain : offset(2,0)

    enemy1: Value 'Right' Equal to 1

    enemy1: overlaps Terrain : offset(-2,0)

    enemy1: Value 'Left' Equal to 1

  • The offset idea is good but I'm still not sure how to get the enemy to bounce correctly. Setting angles doesn't seem to work, the simple bounce action doesn't work (although one of the enemies bounces in that case ???), and doing a rotation doesn't really work either.

  • Why not give the enemy ships the Ball behavior instead of the 8-direction?

  • That's a good idea. I tried it and it works OK but they bounce around in different directions. Is there a good way to constrain them to left/right or up/down (ie 90 degree angles) only?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In that case you could use the bullet behavior with a event "on collision with terrain" rotate 180 degrees CW.

  • The bullet thing worked great. Thanks!

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