Not logged inOpenClonk Forum
Up Topic [Particles] Fire

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Zapper
Looks nice already, some minor things:

> for (var i = 0; i < 2; i++) CreateParticle("Magic", RandomX(-width, width), RandomX(-height, height), 0, -20, height, sparks);


If you want to create multiple particles in one call, you can use the amount parameter like so:
CreateParticle("Magic", PV_Random(-width, width), PV_Random(-height, height), 0, -20, height, sparks, strength/2);
Also, I would suggest scaling the amount of sparks with the fire strength, like in the line above :)

Another general thing:
If you want to do an performance improvement, you could create all the necessary proplists (like sparks, yellowflash, redflash etc.) only once in Fx*Start and then use them in Fx*Timer instead of recreating them every frame.
Example:

func FxFireStart(target, effect, temp)
{
    if (temp) return;
    effect.yellowflash =
    {
        ...
    };
}

func FxFireTimer(target, effect, time)
{
    ...
    CreateParticle(..., effect.yellowflash,...);
    ...
}

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill