• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

SOLVED Collision on tiled objects?

Axl Trauts

Member
Hi

I have a flammable set of objects (children of parent par_flammable) that when they collide with an ignitier (i.e. a fire object) they start to burn and set a fire variable to 1.
I also have a check that when a "fire = 1" flammable object collides with a "fire = 0" flammable object, it turns to 1, and so untill there are no more collisions.

It works fine on overlapping objects, but if I set it on tiled objects like oil terrain, of course they dont overlap, they are just adjacent. How can I check if there are par_flammable objects adjacent as tiles?

I submit an example. Left are the overlapping objects that work fine. To the right, the adjacent objects (64x64) don't work.
The oil sprites just have a full image collision mask, just in case. I had a precise mask with pixels that touch opposite edges of the next tile.
 

Attachments

TheouAegis

Member
if fire {
with instance_place(x+sprite_width,y,par_flammable) fire=1;
with instance_place(x-sprite_width,y,par_flammable) fire=1;
with instance_place(x,y+sprite_height,par_flammable) fire=1;
with instance_place(x,y-sprite_height,par_flammable) fire=1;
}
 

TheouAegis

Member
Although a more efficient (?) method in this case would be to add the first par_flammable that has fire set to 1 added to a list, then while that list's size is greater than 0, get the id of each of its neighbors (see above) and check if the neighbor's fire is 0. If so, set it to 1 and add the neighbor to the list. After checking all four directions, delete the current par_flammable from the list.
 

Axl Trauts

Member
Thanks! I was considering doing that but I was hoping something more official, like a built-in function. Anyways, I'm trying the list.
 
Top