limiting times an event can happen?

Talk about making games.

limiting times an event can happen?

Postby game_mate » Tue Dec 14, 2004 9:22 pm

is there a way to creat an event that can only happon once or after a certain time. like a collition event or a key down event(such as jumping)?
game_mate
 
Posts: 16
Joined: Sat Dec 11, 2004 2:37 am
Score: 0 Give a positive score

Postby jazz_e_bob » Tue Dec 14, 2004 9:50 pm

Create an actor variable called "canShoot".

Set it to 1.

Your shoot key checks if canShoot is 1.
If it is 1 it fires a bullet then sets camShoot to 0 and starts a timer.
The timer event sets canShoot back to 1.

If the timer is set to 1000 you can only shoot a bullet evey one second!

Image
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron