SPRITE_POSITION

SPRITE_POSITION N,X,Y

SET THE X AND Y COORDINATES OF THE SPRITE NUMBER N

  • Type: Command
  • Parameters: 3
  • Group: SPRITE

ACTION

The command SPRITE_POSITION N,X,Y set the (X,Y) coordinates of the SPRITE number N and places it at the position (X,Y).

The coordinates of a SPRITE are "screen" coordinates in the SCENE2D : the first X value of the coordinate specifies a horizontal position on the SCENE2D that counts from left to right. The second Y value of the coordinate specifies a vertical position on the SCENE2D that counts from top to bottom.

The coordinates (0,0) are the coordinates of the upper left corner of the SCENE2D.

SYNTAX: SPRITE_POSITION N,X,Y

  • N = SPRITE number (integer or real). Must be greater than 0 and less than or equal to the allowed maximum number of SPRITE objects.
  • X = new position in X (horizontally) on the SCENE2D. X can be an integer or a real number.
  • Y = new position in Y (vertically) on the SCENE2D. X can be an integer or a real number.

USE

  • The command SPRITE_POSITION N,X,Y is used to move the SPRITE number N in X and Y on its SCENE2D.

ERROR

  • If position X is not a correct expression.
  • If position Y is not a correct expression.
  • If the SPRITE number N does not exist.

EXAMPLE

rem create a 2D world number 1

scene2d 1

rem load a background picture

file_load 1,"city.bmp"

rem create a SPRITE number 1

sprite 1

rem load a picture to the SPRITE

sprite_file_load 1,"alien.bmp"

rem place the SPRITE on the SCENE2D

sprite_position 1,150,250

SEE ALSO

SPRITE_X_POSITION

SPRITE_Y_POSITION