i'm trying to make a tick based loop to simulate smoke from chimney, basically "throw smoke" every second.
i started writing something like this but don't know how make this loop :-\
private int Burnticks = 60;
public override void Tick()
{
base.Tick();
Burnticks--;
if (Burnticks == 0)
{
MoteMaker.TryThrowSmoke(base.Position.ToVector3Shifted(), 4f);
}
You must reset your Burnticks varizblr to 60 when it reaches 0.
public override void Tick()
{
base.Tick();
Burnticks--;
if (Burnticks == 0)
{
Burnticks = 60;
MoteMaker.TryThrowSmoke(base.Position.ToVector3Shifted(), 4f);
}
Quote from: Rikiki on December 24, 2014, 11:15:44 AM
You must reset your Burnticks varizblr to 60 when it reaches 0.
public override void Tick()
{
base.Tick();
Burnticks--;
if (Burnticks == 0)
{
Burnticks = 60;
MoteMaker.TryThrowSmoke(base.Position.ToVector3Shifted(), 4f);
}
thanks, learning so much from you ;)
As a nice C# trick, you can actually shorten this by one line and turn it into this:
public override void Tick()
{
base.Tick();
if (--Burnticks == 0)
{
MoteMaker.TryThrowSmoke(base.Position.ToVector3Shifted(), 4f);
Burnticks = 60;
}
}