Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Glenjamin on Sat 04/04/2015 00:05:31

Title: Relative movement help
Post by: Glenjamin on Sat 04/04/2015 00:05:31
I'm trying to make a game where if you use the "move" verb on the player, he'll sidestep to the right or left. I cant use "player.walk" because it uses coordinates of the room, not coordinates relative to the character. How can I do this?
Title: Re: Relative movement help
Post by: monkey0506 on Sat 04/04/2015 01:54:27
If you need coordinates relative to the player, why not just use the player's coordinates?

Code (ags) Select
player.Walk(player.x + 5, player.y); // sidestep to the right by 5 px
player.Walk(player.x - 5, player.y); // sidestep to the left by 5 px
player.Walk(player.x, player.y + 5); // step toward the bottom of the screen by 5 px
player.Walk(player.x, player.y - 5); // step toward the top of the screen by 5 px
Title: Re: Relative movement help
Post by: Glenjamin on Sat 04/04/2015 03:19:07
Clever, I didn't think of that. Thank you!