Z
Zyr0
Guest
Hello everyone ! So, I'm in trouble, and I would appreciate your help.
My issue is as follow :
What I have :
I have a simple controller that randomly generates objects in my room. (Trees, Rock etc...) It doesn't use grids, I wanted the placement of my objects to look more random.
The rest of the room is a layer of ground tiles and a layer of water tiles.
What I want to do :
I want to use a common parent for my randomly generated objects which commands them to self-destroy if they exist in water. So what I want is to make the objects KNOW which tile they are currently standing on, and if it is water, make them instance_destroy().
What I tried :
I tried about every combination of functions on the Yoyo page about tilemap :
https://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/rooms/tilemaps/index.html
I tried a method from someone on reddit : (His script worked, but it involved re-doing my random terrain generation a way I didn't like. Simply adapting his method to mine didn't seem to work.)
https://www.reddit.com/r/gamemaker/comments/a180qf/checking_for_general_tile_collision/
And finally, I tried to follow a bunch of tutorials : (I'm giving one example here but all of these tutorials have the same problem : they check for tile collision to prevent you from clipping through the borders of the tiles, but what if you are already in ?) (PS : Same goes for the yoyo in-built demo about tile-based collision.)
https://forum.yoyogames.com/index.php?threads/gms-2-tilemap-as-collision-maps-gmwolf.13182/
If you manage to help me with this, I'll kiss you or something.
My issue is as follow :
What I have :
I have a simple controller that randomly generates objects in my room. (Trees, Rock etc...) It doesn't use grids, I wanted the placement of my objects to look more random.
The rest of the room is a layer of ground tiles and a layer of water tiles.
What I want to do :
I want to use a common parent for my randomly generated objects which commands them to self-destroy if they exist in water. So what I want is to make the objects KNOW which tile they are currently standing on, and if it is water, make them instance_destroy().
What I tried :
I tried about every combination of functions on the Yoyo page about tilemap :
https://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/rooms/tilemaps/index.html
I tried a method from someone on reddit : (His script worked, but it involved re-doing my random terrain generation a way I didn't like. Simply adapting his method to mine didn't seem to work.)
https://www.reddit.com/r/gamemaker/comments/a180qf/checking_for_general_tile_collision/
And finally, I tried to follow a bunch of tutorials : (I'm giving one example here but all of these tutorials have the same problem : they check for tile collision to prevent you from clipping through the borders of the tiles, but what if you are already in ?) (PS : Same goes for the yoyo in-built demo about tile-based collision.)
https://forum.yoyogames.com/index.php?threads/gms-2-tilemap-as-collision-maps-gmwolf.13182/
If you manage to help me with this, I'll kiss you or something.