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)
When Bad People Make Good Art
I offer six guidelines on cancel culture ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏...
-
code.gs // 1. Enter sheet name where data is to be written below var SHEET_NAME = "Sheet1" ; // 2. Run > setup // // 3....
No comments:
Post a Comment