• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Physics click to move. Gm studios 1

H

harryhotfist

Guest
I need physics for click to move but i cant figure it out
Obj_mouseClick
Event: step :
if(place_meeting(x,y,obj_player)){
image_alpha = 0;
} else {
image_alpha = 1;
}
Event: Glob Right Button :
x = mouse_x
y = mouse_y


obj_player
Event: step :
if(instance_exists(Obj_mouseClick)){
mouseDistance = point_distance(x ,y, Obj_mouseClick.x, Obj_mouseClick.y);
move_towards_point(Obj_mouseClick.x,Obj_mouseClick.y, min(4, mouseDistance));
}
Event: Glob Right Button :
if(!instance_exists(Obj_mouseClick)){
instance_create(mouse_x,mouse_y,Obj_mouseClick);
}
 

TheouAegis

Member
First off, make sure Obj_mouseClick is below obj_player in the Resource Tree.

You said you need "physics" for the action. Do you mean you need this to work in the Box2D Physics engine, or do you mean you just need the mechanics to work? Your code you have now is fine as long as you don't have the "Physics" options enabled anywhere in the obj_player or in the room.
 
H

harryhotfist

Guest
First off, make sure Obj_mouseClick is below obj_player in the Resource Tree.

You said you need "physics" for the action. Do you mean you need this to work in the Box2D Physics engine, or do you mean you just need the mechanics to work? Your code you have now is fine as long as you don't have the "Physics" options enabled anywhere in the obj_player or in the room.
Im trying to use physics in the room but my charactor wont move with it on.
 
Top