Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: DarkestMaiden on Mon 01/03/2010 01:03:46

Title: Player's starting position
Post by: DarkestMaiden on Mon 01/03/2010 01:03:46
Hi, I've been giving AGS a go and I've succeeded in animating my sprites and making a walkable area, but I can't seem to get my player to start within the walkable area. When I run my game in the test my character is floating in the air, and I cannot move her. How do I specify exactly where my character should appear when the room fades in on AGS?

Thanks so much.
Title: Re: Player's starting position
Post by: Calin Leafshade on Mon 01/03/2010 01:10:44
2 ways.

either set StartX and StartY in the characters properties (down the right hand side when the character is selected)

or set them in the script in the Before Fade-in function, which you can set in the rooms events (click the lightning bolt when your editing a room properties);

the code you would need would be something like


player.x = 100;
player.y = 150;
Title: Re: Player's starting position
Post by: monkey0506 on Mon 01/03/2010 01:13:51
There is also Character.PlaceOnWalkableArea which you can use such as:

player.PlaceOnWalkableArea();

Inside of the room before fade-in function (or wherever else you need it).

This function will attempt to position the character to the nearest possible point (AFAIK) that is contained within a walkable area.
Title: Re: Player's starting position
Post by: DarkestMaiden on Mon 01/03/2010 13:31:24
Thank you so much for your help!
I used Start x and Start Y.