I have player sprite with 8 direction move behavior now when projectile hit the player from right side player shuld be push to left side for example 50 pixels even if sprite angle is 270' ( looking up)
Second question
its possible to simulate control more direction than up,down,left,right?
Just check the impact of the bullet. For example x position or direction. then move the victim to the the opposite direction.
For animations you can write some code on "every tick" or use position plugins like "moveTo".
Develop games in your browser. Powerful, performant & highly capable.
DAG you have right "r example x position or direction. then move the victim to the the opposite direction." but how do this?
i need this in all directions not only x and y
Just use the direction of the bullet.
For example calculate the angle(xprev,yprev,x,y) or x/y separately (dx = xprev-x; dy = yprev-y).
On collision - move the the object towards to the angle.