Player's starting position

Started by DarkestMaiden, Mon 01/03/2010 01:03:46

Previous topic - Next topic

DarkestMaiden

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.

Calin Leafshade

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

Code: ags

player.x = 100;
player.y = 150;

monkey0506

There is also Character.PlaceOnWalkableArea which you can use such as:

Code: ags
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.

DarkestMaiden

Thank you so much for your help!
I used Start x and Start Y.

SMF spam blocked by CleanTalk