I recently implemented a custom 8 direction movement system to my game. I store the xPlayer and yPlayer as variables, and then I set the x and y position to these variables. I am then trying to use the Move Safely 2 object for collision detection.
The code for when a player moves up or down is:
yPlayer = yPlayer( "Player" ) + ( MoveY( "Player" ) * speedControl("Player")
This causes the Move Safely Object 2 not work, as when a player collides when an obstacle, the yPlayer variable continues to increase while the player remains in the spot moving up against the obsticle, and then suddenly the player warps to the yPlayer coordinate once the player is no longer colliding with the obsticle.
A solution to fix this is to change the formula to:
yPlayer = Y( "Player" ) + ( MoveY( "Player" ) * speedControl("Player")
The problem with this though, is that I can no longer affect the speed properly with a float value like the speedControl variable.
I am assuming I just have to ditch the Move Safely object and opt for a custom solution that uses the alterable values instead of player position for the push out feature.
I wanted to post and see if anyone had a good solution already made for an 8 direction custom collision detection system like this, or if anyone had any ideas for how to work with the Move Safely Object for my specific problem.
Any help or guidance would be greatly appreciated! Thanks!