Simulating Collision Behaviour

0 favourites
  • 13 posts
  • I am attempting to simulate 8-directional movement using the bullet behaviour. Unfortunately this means I can't use the default collisions that come with it so I was wondering if it is possible to simulate the way 8 direction behaviour deals with collision.

    Here is an example of what I have currently. I'm trying to make it so you cannot walk on the red collision mask.

    The .Capx

  • easiest would probably be putting all collision objects in a family and

    bullet on collision with family- set speed to 0

  • For some reason on collision doesn't work only overlap does.

    This works for stopping him but it stops him from moving in all directions. In the 8-Dir movement you can still move in the other 3 directions while touching the collision object.

    I initially figured I could make it so that when you overlap the object you have the object move the character in the opposite direction so that your movement onto the object is always offset but I can't figure out how to do it.

    So for each step forward you are forced one step back in the direction you are trying to go until you are off the object.

  • Maybe you should set the bullet to bounce of solids to true. I thought the on collision worked with that setting, but I might be mistaken.

    Bullets often move too fast (too many pixels per tick) to have accurate collision-detection.

  • another option would be to use a while event.

    That would become something like this:

    is overlapping set bullet speed to 0

    while bullet is overlapping - bullet move 5 pixels at angle bullet.angle+180

  • Yep, that works, but you could also just use is overlapping instead of the system pick collisions action.

  • Yep, that works, but you could also just use is overlapping instead of the system pick collisions action.

    I actually tried enabling several 'default' methods ... none worked ... especially not directional reply xD

    As he stores it in a sepperate value in a player sprite instance variable.

    I am not sure it works very efficient though (the controls)

  • I just replaced the last event with player is overlapping collisions and it still works..

  • I just replaced the last event with player is overlapping collisions and it still works..

    lol, figures

    The last changes I made was making the direction based on the instance var ^_^    (it didnt work otherwise lol)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh wow, thanks guys!

    This certainly seems to work though now I'd have to figure out how to keep the Player from shaking.

    My initial reason for doing the controls this way was to experiment but also I don't really like how the 8-dir movement works. I couldn't find a half decent way to keep it from feeling slightly slippery.

  • :D ur welcome

    to stop the shaking, I think you should match the speed of the reverse to match the speed of the moving. Or simply disable moving all together.

    your angle of direction is stored in a variable, in most cases, you simply have to refer to the angle like player.InstanceVarWithAngle instead of player.Angle.

  • .CAPX

    I managed to reduce it a bit but it's still there.

    I set it to disable movement if you are overlapping and enable it if you aren't and set it so it has to only move the Player 1 pixel out. I was messing with the various speeds but it seems like if I mess with them it just makes it so the Player goes deeper into the collision box even though the speed isn't represented in how fast you move.

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