room_tile_add

Add a new tile to a room and return its index.

Syntax:

room_tile_add(ind, back, left, top, width, height, x, y, depth);


Argument Description
ind The index of the room to add the tile to.
back The background from which the tile is taken.
left The x coordinate of the left side of the tile relative to the background.
top The y coordinate of the top side of the tile relative to the background.
width The width of the tile.
height The height of the tile.
x The x coordinate of where to place the tile.
y The y coordinate of where to place the tile.
depth The depth of the tile in the room.


Returns: Real


Description

With this function you can add a tile to any room from any background. You specify the position within the background to get the tile from and the position within the room as well as the depth that the tile should have. The function returns a unique id number for that tile that you can use for further tile functions.


Example:

global.rm = room_add();
room_assign(rm_Base, global.rm);
room_tile_add(global.rm, tl_grass, 0, 0, 256, 32, 0, 400, 10000);

The above code will add a new room to the game and then copy the contents of the room indexed as "rm_Base" into it. It will then add a tile into the room taken from the background indexed as "tl_grass".


Back: Rooms
Next: room_tile_add_ext
© Copyright YoYo Games Ltd. 2018 All Rights Reserved