Usage
Syntax: getdir(float deltaX, float deltaY)
Returns direction.
Explanation
Returns a reasonable direction for the player to be facing for the specified velocity/delta-position.
Example
function onCreated() { temp.velocityX = -2; temp.velocityY = 0.5; player.dir = getdir(temp.velocityX, temp.velocityY); //Does not change the player direction. player.dir = getdir(vecx(player.dir), vecy(player.dir)); }
... Will set player.dir to 1.
Categories
CategoryFunctionClientside
CategoryFunctionServerside
There are no comments on this page. [Add comment]