GameMaker How To Make Player Move Toward Mouse
Вставка
- Опубліковано 7 гру 2014
- GameMaker tutorial / lesson that shows how to make the player or an object move toward the mouse location, and stop when they get there. Check out hundreds of other GameMaker tutorials and lessons at GameProgrammingCourse.com
All these gamemaker tutorials will work with Gamemaker Studio GMS or Gamemaker Studio 2 GMS.
Go to the Resource Page of www.gameprogrammingcourse.com to download the Project Files for these tutorials!
Still relevant to the latest version of Game Maker, and a much simpler way than what's on the forums!
omg, I couldn't figure out how to make my character stop spazing. thank you for making this you beautiful human omg this helped me so much
This is what I was looking for:))) Thnx for your tutorials!)
Molto utile GRAZIE !!ottimo tutorial :-))
what about collisions with the wall? I really need you on this please help me!! How to stop the player when it touch the wall?
I know its 7 years late but maybe to help others -
Search my videos on Path Finding. Gamemake has some built in path finding functions that can solve paths to avoid specified objects.
@@gamemakergameprogrammingco4786 You know what's funny? I've been thinking about GameMaker lately and now I see your comment :D
Hope you're doing all right.
Can you make one for dnd too
Hey there! Do you have any idea how to left click on a moving object
(say an enemy) and then have your player move towards it? like diablo
does for its attacking system. im not to concerned about the attacking
bit i just need to be able to move to another moving object. ive been
trying for five days now and i cant figure it out :(
So far ive managed to get it so if you hold the mouse button down over an object the
player will move to it, but i want to be able to just click once...here is the code i have so far
///Attaking Engine
if position_meeting(mouse_x, mouse_y, obj_enemy) and
(mouse_check_button(mb_left)) {
if point_distance(x, y, obj_enemy.x, obj_enemy.y) > 20
action_potential_step(obj_enemy.x, obj_enemy.y, 3, 0)}
else speed = 0;
if you would like to see the project you can download it off the game maker forums...gamemakersforums.com/threads/moving-an-object-to-another-moving-object.1233/
Please any help would be great and i would be extreamly grateful. Thanks
I don't know if you still monitor this, but how can I change an object's angle when it goes above and below the x-axis, but then stay at it's normal angle if at 0 on the x-axis?
I'm not sure if you mean y axis (up down above below) . Either way same code.
if x>0
image_angle = 10
else if x
Gamemaker Game Programming Course Thanks, bro! Much appreciated!
i only want my caracther to face left and ight i just need to know where is it 0
if mouse_x > x {
image_xscale = 1
}
else {
image_xscale = -1
}
if you are just concerned about left and right then just check the x position of the mouse compared to player x position.
ok
now i see verry logical
+scroobgames might be imagex_scale
ok
hmm, if anyone checks this anymore, what if I want the player to be the mouse when I click on him until I click again?
Basically you are dragging the player around. A few ways to do it. Here's one of my sections on mouse control. You'll see there is a drag and drop lesson in there.
www.gameprogrammingcourse.com/?p=565