AnotherHero
Member
Hey everybody,
I'm making a short action game and I'm using tile collision. I am trying to implement a basic building system. The actual building is fine but I need to add collision between the player and built structures. The code I attempted to use, in the building's draw event is:
But that's not working. I'm trying to create a total of 4 collision tiles on the building (the bottom half of the sprite, with some room in the middle for the door).
I read the documentation on drawing tiles but it didn't make much sense to me. For example, I don't know why everyone uses tile_set_flip.
If I need to make anything clearer, I'm happy to. Or if you have any questions that might help lead to a solution I can answer! But in the meantime, thank you for your help and time.
I'm making a short action game and I'm using tile collision. I am trying to implement a basic building system. The actual building is fine but I need to add collision between the player and built structures. The code I attempted to use, in the building's draw event is:
Code:
draw_self();
///@desc create collision tiles
var _tile1x = x - 40;
var _tile2x = x - 24;
var _tile3x = x + 23;
var _tile4x = x + 39;
var _layerID = layer_get_id("Collision");
var _mapID = layer_tilemap_get_id(_layerID);
var _data = tilemap_get(_mapID, 0, 0);
_data = tile_set_flip(_data, true);
//Set tile 1
draw_tile(tile_collision,_data,0,_tile1x, y -16);
//Set tile 2
draw_tile(tile_collision,_data,0,_tile2x, y -16);
//Set tile 3
draw_tile(tile_collision,_data,0,_tile3x, y -16);
//Set tile 4
draw_tile(tile_collision,_data,0,_tile4x, y -16);
I read the documentation on drawing tiles but it didn't make much sense to me. For example, I don't know why everyone uses tile_set_flip.
If I need to make anything clearer, I'm happy to. Or if you have any questions that might help lead to a solution I can answer! But in the meantime, thank you for your help and time.