Only one

Non-platform specific questions.

Only one

Postby ganondolf » Mon Jan 25, 2010 3:46 pm

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
The only thing for sure is that nothing is for sure
User avatar
ganondolf
 
Posts: 12
Joined: Mon Jan 25, 2010 3:20 pm
Score: 0 Give a positive score

Re: Only one

Postby Hblade » Mon Jan 25, 2010 4:10 pm

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;
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Only one

Postby ganondolf » Mon Jan 25, 2010 4:50 pm

works great, thanks
The only thing for sure is that nothing is for sure
User avatar
ganondolf
 
Posts: 12
Joined: Mon Jan 25, 2010 3:20 pm
Score: 0 Give a positive score

Re: Only one

Postby Hblade » Mon Jan 25, 2010 6:09 pm

welcome
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron