Page 1 of 1

Only one

PostPosted: Mon Jan 25, 2010 3:46 pm
by ganondolf
hi,

I have a on screen button (touch screen button, wm), when i press the button a actor appears (bullet).
The problem i am having is that it u press or hold the button unlimited bullets are created.

I need the code to either make a delay between the creation of bullets (after one is made, the button wont make another for 1 sec) or to allow only one bullet (bullet actor) to be created at on screen (so bullet would need to be destroyed before the button would make another).

if anyone can help i would appreciate it

Re: Only one

PostPosted: Mon Jan 25, 2010 4:10 pm
by Hblade
Make a variable called temp
On mousedown (Or touch) put this script in the Script Editor
Code: Select all
if (temp == 0)
{
(Make the bullet actor)
temp = 1;
}

And on mouse up, (Or touch release) put this script in script editor
Code: Select all
temp = 0;

Re: Only one

PostPosted: Mon Jan 25, 2010 4:50 pm
by ganondolf
works great, thanks

Re: Only one

PostPosted: Mon Jan 25, 2010 6:09 pm
by Hblade
welcome