background_y

Returns or sets the y position of any background within a room.

Syntax:

background_y[0...7]


Returns: Real


Description

This variable array returns the y position within the room of any one of the 8 backgrounds (numbered form 0 - 7 within the array) of the current room. You can use this variable to position backgrounds at specific places within a room, even when the background being used is also tiled vertically or horizontally (in which case the whole "sheet" of tiled backgrounds will be moved).


Example:

background_x[0] = view_xview[0];
background_y[0] = view_yview[0]-50;
background_x[1] = view_xview[0]/2;
background_y[1] = view_yview[0]/2+335;
background_x[2] = view_xview[0]/8;
background_y[2] = view_yview[0]/8+500;

The above code changes the x and y values of three backgrounds in a room based on the position of the view (this effect is called parallax scrolling).


Back: Backgrounds
Next: background_colour
© Copyright YoYo Games Ltd. 2018 All Rights Reserved