Hey all
How do i make fire spread from one sprite or tile to another (not sure which would be better as it has an animation, individual sprites or tiles for the ground) and depending on the wind spread left if the wind is blowing left or right if it’s blowing right etc. I have tried a few things but haven’t had much luck.
Interesting concept. Is it top-down or side-view.
Do you have anything that you can share like a screenshot of some events or of the scene?
I wonder if a burning tile or object could spawn ember like objects with a force added using the wind direction. You could use a timer that slowly reduce the interval time so they spawn more frequently as the fire grows. Maybe the embers could have particle emitters stuck to them. When an ember touches another tile, it could set it on fire.
The embers could be deleted after the collision and/or fade out using an opacity tween or timer.
You could also use a counter on the tiles, so it could take several embers to set them on fire. Or maybe add some randomness that would determine if the tile ignited.
This could be overkill for what you have in mind but parts of the concept might help.
I guess it could be simplified if the ember itself became the fire after a certain distance or time. Maybe some randomness to decide whether the ember becomes a fire.
So this is the basic scene I’m trying to figure out how to make it more streamlined with tiles instead of individual objects for the Forrest (it’s very early art too).
This is also pretty much the event I turned back to but I’ve added a timer I just can’t figure out how to make it spread certain directions. I really like the idea of embers that would make it perfect I’m just struggling with collisions with particle systems.
Particles don’t have a collision. You could stick an emmiter onto another object. Either as an ember or hidden.
Are the lines the forest? It’s a shame the new tilemap can’t do animation. Are the lines individual objects or a stretch tilemap? Or is it all 1 object?
Edit: I was looking at the lines not the grass.
Can you explain what the lines on the left are?
So the Forrest is all individual objects for testing but in reality that won’t work because it will definitely cause to much lag if it’s a massive Forrest.
The grey lines are test roads as I am trying out path finding
Hmmm. I don’t really have any other ideas. I can help with any techniques or events but I don’t have any other ideas.
If I may, how about something like this,
Give the fire a bit of a timer.
After a few seconds or so, the fire will send out a hidden projectile (or spark) or something to it’s immediate surroundings. In the case of the image you posted, that should probably be in the eight directions right around it.
But with the wind element, perhaps you might want to only send sparks where the wind is going. Like if the wind is blowing to the right (0 degrees), only send sparks towards the 0 degree area Then send out add a couple more, one for the 0-45 degrees and then one for the 0+45 degrees. If the wind is not that strong maybe include also -90 and +90 degrees.
Upon getting sent out, each spark will then check if it’s location is within the forest area or inside the forest collision mask or if it’s in contact with some other flammable object. Also check whether that location already has a fire object in it or not.
If the conditions are met, then create fire object and delete the spark object. Then the cycle goes on with the new fire objects. Might wanna consider also to turn off each fire after some time unless you’d like the fire to continue burning forever, which I think is rather unlikely. It might help mitigate potential lag.
That sounds like it should work well, how do I check if the spark is within the Forrest’s collision mask?
Under the condition options you should be able to find “Collision” and “Point inside object”. I suppose either should work fine.