Diagonal Collisions?

Essentially what I'm trying to do is convert code that would either push the hero or enemy back either straight, or diagonally.

degree = radtodeg(arctan2(vec1.y - vec2.y, vec2.x - vec1.x));Now Vec1 and Vec2 are variables, 1 is for the hero, and 2 is for the enemy.

kd

I'm currently working on a seiken densetsu type of battle system, and so far everything seems to be going smoothly.  But one thing I remembered is that some enemies would be pushed diagonally of course this is dependent of where the hero is and the enemy is once striked, the code above actually does work but it's from an old C#/XNA project.

I'm currently looking for the best way to call/implement the code into RGSS/3.
there are several existing scripts for 8-dir-moves and for pixel movement on the master script list.


It might help you to check those as guidelines how to create your script.


(sorry, I don't have the links available, just search on the master script list)

Original thread: https://forums.rpgmakerweb.com/threads/diagonal-collisions.22626/