Direction

From Game Editor

Jump to: navigation, search

double direction(double x1, double y1, double x2, double y2);

direction returns the angle (in degrees) between point (x1,y1) and (x2,y2).


Example: Create a homing bullet that locks onto the player.

bullet -> Draw Actor -> Script Editor

angle=direction(x, y, player.x, player.y);