Custom Movement and Collisions, I have only one side working

0 favourites
  • 2 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • I'm having trouble making my own collisions/bouncing with the custom movement behavior.

    I have the ship bounce against a wall and when it bounces on the left and right sides the bouncing angle looks correct, but top and bottom collision the angle is wrong and the ship just reverses.

    Here's my code:

    If I swap the order of the two events in the collisions group, then top and bottom work while left and right don't. I'm kinda stumped.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think you need to detect which side is being collided with for it to work right.

    Maybe you could do something like this?

    Sprite on collided with tiledbg

    Sprite.y<tiledbg.top

    Or

    Sprite.y>tiledbg.bottom

    bounce vert

    Sprite.x<tiledbg.left

    Or

    Sprite.x>tiledbg.right

    bounce horz

    A more robust way could be to compare angles like

    Angle(tiledbg.x,tiledbg.y,Sprite.x,Sprite.y) is within 45 degrees or 0

    bounce horz

    Anyway just some ideas

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