room_set_background

Sets a background and its related attributes of a given room.

Syntax:

room_set_background(ind, bind, vis, fore, back, x, y, htiled, vtiled, hspeed, vspeed, alpha);


Argument Description
ind The index of the room to set the background of.
bind The index of the background 'slot' to set (between 0 and 7).
vis Whether the new background is visible (true) or not (false).
fore Whether the background is actually a foreground (true) or a background (false).
back The index of the new background.
x The x position of the background (if htiled is true, the x of one of the backgrounds).
y The y position of the background (if vtiled is true, the y of one of the backgrounds).
htiled Whether the background is tiled horizontally (true) or not (false).
vtiled Whether the background is tiled vertically (true) or not (false).
hspeed The horizontal speed of the background in pixels per step.
vspeed The vertical speed of the background in pixels per step.
alpha The alpha (transparency) of the background. 1=opaque, 0=invisible, 0.5=translucent etc


Returns: N/A


Description

With this function you can set a background for a room (except the current one), with all the same property options that you can find in the room editor like horizontal speed and horizontal or vertical tiling.


Example:

global.rm = room_add();
room_set_background(global.rm, 0, 1, 0, bck_Space, 32, 32, 1, 1, 4, 0, 0.8);

The above code will add a new room to the game and then set the background of that room to the background indexed as "bck_Space" and set the properties for that background.


Back: Rooms
Next: room_set_background_colour
© Copyright YoYo Games Ltd. 2015 All Rights Reserved