Facing n direction of moving

In my game a dog is following the player. Currently image_angle = direction. The dog has a four-directional sprite (dogUp, dogDown, dogLeft and dogRight). How can I change the sprite based on the direction of the dog, and how can I make it that the dog only travels left, right, up and down(i.e not diagonally). Thank you for your help!


Try create your own movement code.
Check if the player x is compare to the dog.
Ex if x>dog.x go right until in next grid poa

you can also use mp_grid_path and disable diagonal movement


dir= radtodeg(arctan2(keyboard_check(vk_up) - keyboard_check(vk_down), keyboard_check(vk_right) - keyboard_check(vk_left)))
Do you not know how if statements and sprite_index work yet? If you do, then ask yourself when you want your dog's sprite to change to his up sprite in basic English. Then convert it to code.

If you don't know how those two very basic parts of GameMaker work, you should read through the manual and do at least the basic tutorials that come with gamemaker.

What you're asking to do is very basic. With a little bit of initiative and research, you should have no problem getting this done. Try it out and post what you come up with. If you can't figure it out after a few hours, I'll help you a bit more, if nobody else gives you the answer.