Risorse – Room

Le funzioni seguenti forniscono informazioni su un livello:

room_exists() ind Dato l’indice di un livello restituisce: esiste?, il nome
room_get_name() ind

Nota che, siccome i livelli cambiano mentre giochi il livello, ci sono altri metodi per ottenere informazioni sul livello attuale.

Modificare Room

Manipulating rooms on the fly is a dangerous thing to do.
You have to realize that rooms change all the time due to what is happening in the game.
This normally only involves the currently active room and there are many routines described in previous sections to manipulate the instances, backgrounds, and tiles in the active room.
But changes in the active room will last if the room is persistent.
Hence, you should never manipulate aspects of the currently active room or any room that is persistent and that has already been visited before. Such changes in general won’t be noticed but might sometimes even lead to unexpected errors.
Due to the fact that rooms are linked in a complicated way there is also no routine to delete a room.

The following routines are available

room_set_width() ind
w
Sets the width for the room with the indicated index.
room_set_height() ind
h
Sets the height for the room with the indicated index.
room_set_caption() ind
str
Sets the caption for the room with the indicated index.
room_set_persistent() ind
val
Sets whether the room with the indicated index is persistent or not.
room_set_code() ind
str
Sets the initialization code string for the room with the indicated index.
room_set_background_color() ind
col
show
Sets the color properties for the room with the indicated index if is does not have a background image.
col indicates the color and show indicates whether the color must be shown or not.
room_set_background() ind
bind
vis
fore
back
x,y
htiled,vtiled
hspeed,vspeed
alpha
Sets background with index bind (0-7) for the room with the indicated index. vis indicates whether the background is visible and fore whether it is actually a foreground.
back is the index of the background image.
x,y indicate the position of the image and htiled and vtiled indicate whether the image must be tiled.
hspeed and vspeed indicate the speed with which the background moves and alpha indicates an alpha translucency value (1 = solid and fastest).
room_set_view() ind
vind
vis
xview,yview
wview,hview
xport,yport
wport,hport
hborder,vborder
hspeed,vspeed
obj
Sets the view with index vind (0-7) for the room with the indicated index.
vis indicates whether the view is visible.
xview, yview, wview, and hview indicate the position of the view in the room.
xport, yport, wport, and hport indicate the position on the screen.
When the view must follow an object hborder and vborder indicate the minimal visible border that must be kept around the object.
hspeed and vspeed indicate the maximal speed with which the view can move.
obj is the index of the object or the index of the instance.
room_set_view_enabled() ind
val
Sets whether views must be enabled for the room with the indicated index.
room_add() Adds a new room.
It returns the index of the room.
Note that the room will not be part of the room order.
So the new room does not have a previous or a next room.
If you want to move to an added room you must provide the index of the room.
room_duplicate() ind Adds a copy of the room with the given index.
It returns the index of the room.
room_assign() ind
room
Assigns the indicated room to room ind.
So this makes a copy of the room.
room_instance_add() ind
x,y
obj
Adds a new instance of object obj to the room, placing it at the indicate position.
It returns the index of the instance.
room_instance_clear() ind Removes all instances from the indicated room.
room_tile_add() ind
back
left,top
width,height
x,y
depth
Adds a new tile to the room at the indicate position.
It returns the index of the tile. back is the background from which the tile is taken.
left, top, width and height indicate the part of the background that forms the tile.
x,y is the position of the tile in the room and depth is the depth of the tile.
room_tile_add_ext() ind
back
left,top
width,height
x,y
depth
xscale,yscale
alpha
Same as the previous routine but this time you can also specify a scaling factor in x and y direction and an alpha transparency for the tile.
room_tile_clear() ind Removes all tiles from the indicated room.

Lascia un commento