d3d_floor_create_from_tile(x, y, w, h, tilelayer)Returns a flat floor where you can use a specific tileset as its texture. If a tile from that tileset is found at the location you check from, the texture will be shown as that tile.
Using gml Syntax Highlighting
///d3d_floor_create_from_tile(x, y, w, h, tilelayer)
//Argument x: x coordinate to check from
//Argument y: y coordinate to check from
//Argument w: width of the tile
//Argument h: height of the tile
//Argument tilelayer: tile layer you check on
//Returns: 3D Model as flat floor (use the tileset as its texture), -4 when no tile is found
var tile = tile_layer_find(argument4, argument0, argument1);
if (tile) {
var xx, yy, bg, hsize, vsize;
xx = tile_get_left(tile);
yy = tile_get_top(tile);
bg = tile_get_background(tile);
hsize = background_get_width(bg);
vsize = background_get_height(bg);
var model = d3d_model_create();
d3d_model_primitive_begin(model, pr_trianglelist);
d3d_model_vertex_normal_texture(model, x, y, z, 0, 0, 1, xx / hsize, yy / vsize);
d3d_model_vertex_normal_texture(model, x + argument2, y, z, 0, 0, 1, (xx + argument2) / hsize, yy / vsize);
d3d_model_vertex_normal_texture(model, x, y + argument3, z, 0, 0, 1, xx / hsize, (yy + argument3) / vsize);
d3d_model_vertex_normal_texture(model, x + argument2, y, z, 0, 0, 1, (xx + argument2) / hsize, yy / vsize);
d3d_model_vertex_normal_texture(model, x, y + argument3, z, 0, 0, 1, xx / hsize, (yy + argument3) / vsize);
d3d_model_vertex_normal_texture(model, x + argument2, y + argument3, z, 0, 0, 1, (xx + argument2) / hsize, (yy + argument3) / vsize);
d3d_model_primitive_end(model);
return model;
}
return -4;
If you have trouble knowing which tileset you use, check with tile_get_background, like it was done in the script. EDIT: When you draw the model, it is crucial you draw it at 0, 0, 0 and not x, y, z! Also, the script requires that the z variable has been initialized.
[b]d3d_floor_create_from_tile(x, y, w, h, tilelayer)[/b]
Returns a flat floor where you can use a specific tileset as its texture. If a tile from that tileset is found at the location you check from, the texture will be shown as that tile.
[syntax=gml]///d3d_floor_create_from_tile(x, y, w, h, tilelayer)
//Argument x: x coordinate to check from
//Argument y: y coordinate to check from
//Argument w: width of the tile
//Argument h: height of the tile
//Argument tilelayer: tile layer you check on
//Returns: 3D Model as flat floor (use the tileset as its texture), -4 when no tile is found
var tile = tile_layer_find(argument4, argument0, argument1);
if (tile) {
var xx, yy, bg, hsize, vsize;
xx = tile_get_left(tile);
yy = tile_get_top(tile);
bg = tile_get_background(tile);
hsize = background_get_width(bg);
vsize = background_get_height(bg);
var model = d3d_model_create();
d3d_model_primitive_begin(model, pr_trianglelist);
d3d_model_vertex_normal_texture(model, x, y, z, 0, 0, 1, xx / hsize, yy / vsize);
d3d_model_vertex_normal_texture(model, x + argument2, y, z, 0, 0, 1, (xx + argument2) / hsize, yy / vsize);
d3d_model_vertex_normal_texture(model, x, y + argument3, z, 0, 0, 1, xx / hsize, (yy + argument3) / vsize);
d3d_model_vertex_normal_texture(model, x + argument2, y, z, 0, 0, 1, (xx + argument2) / hsize, yy / vsize);
d3d_model_vertex_normal_texture(model, x, y + argument3, z, 0, 0, 1, xx / hsize, (yy + argument3) / vsize);
d3d_model_vertex_normal_texture(model, x + argument2, y + argument3, z, 0, 0, 1, (xx + argument2) / hsize, (yy + argument3) / vsize);
d3d_model_primitive_end(model);
return model;
}
return -4;[/syntax]
If you have trouble knowing which tileset you use, check with tile_get_background, like it was done in the script.
EDIT: When you draw the model, it is crucial you draw it at [b]0, 0, 0[/b] and not x, y, z! Also, the script requires that the z variable has been initialized.
_________________
Cliax Codec is a combination of top-down and third-person shooter. The gameplay will blend platforming, puzzle and shmup elements together to create a unique gameplay experience. You will take control of four playable characters which rise against a team that seemingly wants to take over the world - but are their motives really that cliché, or are there deeper motives behind their actions? Currently designing Chapter 1-6, 5% GOTM titles Spoiler:
Fan Art Spoiler:
|
|