Hi,
There is an area that I am trying to incorporate in to a game and I need some assistance.
Basically a timer measures the time you are NOT moving. If you are not moving then the timer goes up 1 a second per second you are not moving (every time you are not moving).
When the player is moving then the timer stops etc etc.
I made a variable 'Stopped_Moving' and a function:
// function top Global asc
function Walking()
{
if(player.Moving)
{
SetTimer(3, 0);
} else
{
Stopped_Moving=(Stopped_Moving +1);
LNotMoving.Text = String.Format("%d", Stopped_Moving);
SetTimer(3, 40);
}
}
I have imported it:
// import Global ash
import function Walking();
// Global asc
// in function repeatedly_execute_always()
}
if (IsTimerExpired(3))
{
Walking();
}
Would someone please give me hand..
Thanks
It's easier to time stuff like this with variables, timers are better for one-off stuff like timed puzzles.
// function top Global asc
int walktimer;
function Walking()
{
if(player.Moving)
{
walktimer=0;
}
else if (walktimer > GetGameSpeed ())
{
Stopped_Moving += 1;
LNotMoving.Text = String.Format("%d", Stopped_Moving);
walktimer = 0;
}
else walktimer++;
}
Thanks Scavenger,
I was sure there was a better way. Works a treat.
many thanks ;)