YoYo Games Wiki

xstart

From YoYoGames Wiki

Description

(real): the initial x coordinate of an object in the room

Explanation

The xstart variable is a local variable that contains the starting x position of an object in the room.

Examples

//this code would be placed in the step event or collision with enemy
//event because that would be when it needs to check if you health is
//out
if health < 1 then
{
 x = xstart;
 y = ystart;
 health = 100;
}

Note that this is not a read only variable, it can be changed:

//for a checkpoint
xstart = checkpoint.x;
ystart = checkpoint.y;
x = xstart;
y = ystart;

See Also

Content from GMKB, was used to expand this article. The content was contributed by cityscape.