Search thousands of free JavaScript snippets that you can quickly copy and paste into your web pages. Get free JavaScript tutorials, references, code, menus, calendars, popup windows, games, and much more.
【GameMaker】 Distance from Object to Mouse
Information about object: obj_distance
Sprite: spr_distance
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:
//set variables:
dist=0;
dir=0;
Step Event:
execute code:
dist=distance_to_point(mouse_x,mouse_y);//store distance in variable
angle=point_direction(x,y,mouse_x,mouse_y);//store the angle
Draw GUI Event:
execute code:
draw_set_alpha(0.5);
draw_self();
draw_set_alpha(1);
//draw variables
draw_text(x,y-40,"Distance "+string(dist));
draw_text(x,y-60,"Direction "+string(angle));
Subscribe to:
Post Comments (Atom)
This will make you a better decision maker | Annie Duke (author of “Thinking in Bets” and “Quit”, former pro poker…
Annie is a former professional poker player, decision-making expert, author, and special partner at First Round Capital. ͏ ͏ ͏ ...
No comments:
Post a Comment