SCENE2D

SCENE2D N

CREATES A SCENE2D AND GIVES IT NUMBER N AS REFERENCE

  • Type: Command
  • Parameter: 1
  • Group: System Objects Creation

ACTION

The command SCENE2D N creates a SCENE2D to display a 2D universe, and gives it a number N. The number N will be used to designate the SCENE2D.

A SCENE2D can display a picture in background and can receive SPRITES. A SCENE2D and SPRITES are the basis of 2D video games. The SPRITES can be moved, hidden, displayed without disturbing the background picture of the SCENE2D, they own a "transparent" color, not displayed.

The SCENE2D is created at position (0,0) : that is TOP = 0 pixel and LEFT = 0 pixel, with dimensions WIDTH = 200 pixels and HEIGHT = 200 pixels.

A SCENE2D can generate the event : ON_CLICK.

Remark: by default, the SCENE2D is created on the FORM number 0, but another FORM can be used. For that, create a FORM by FORM N, and send it all the commands by COMMAND_TARGET_IS N before creating the SCENE2D.

SYNTAX: SCENE2D N

  • N = system object number (integer or real). Must be greater than 0 and less than or equal to the allowed maximum number of system objects.

USE

  • A SCENE2D is used to handle a 2D world with a background picture and SPRITES.

ERROR

  • If number N is not a correct expression.
  • If number N exceeds the allowed maximum number of system objects.
  • If number N is less than or equal to 0.
  • If number N is already used for an object number.

EXAMPLE

rem create a SCENE2D with default position and dimensions

scene2D 1

rem load a background picture

file_load 1,"My 2D world.bmp"

rem change the dimensions of SCENE2D

width 1,600

height 1,400

SEE ALSO

FILE_DIALOG