drawing something longer than one frame?
drawing something longer than one frame?
Basically all I want is when kbd.buttonispressed, drawsomething() will only be drawn for, lets say 60 frames, no matter how long you hold down the button, only 60 frames. I've tried the keyPressedLastFrame method but then it only draws it for one frame. So, anybody have any idea how to do this?
Re: drawing something longer than one frame?
Use an if statement.
Code: Select all
drawSomething()
{
if(kbd.spaceIsPressed)
{
//draw stuff
frames++;
}
}
Code: Select all
composeFrame()
{
if(frames <= 60)
{
drawSomething();
}
}
Re: drawing something longer than one frame?
You would need a boolean and integer for that.
Once you press a button the boolean will become true and the integer 0. Then as an independant function, if the boolean is true, draw something and add one to the integer. Once the integer becomes 60 the boolean will be false again.
Once you press a button the boolean will become true and the integer 0. Then as an independant function, if the boolean is true, draw something and add one to the integer. Once the integer becomes 60 the boolean will be false again.
ʕ •ᴥ•ʔ