Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / 2D Game - Disable continue shooting produced by holding a key pressed???

Author
Message
cHiNo
13
Years of Service
User Offline
Joined: 3rd May 2011
Location:
Posted: 4th May 2011 03:19
Hi, the problem is this, im creating a space-ship-shooter type of game... So i get the ship to shoot in the right direction and everything but i need to disable that if you hold for example the space key pressed it shoots continuosly. I want it to be one click one bullet... This becouse my game creates bullets so close to each other that they fusionate and it seems like a giant bullet.

I dont know if the problem is understandable im not very good on english either... So im sorry...

Bottomline i need to force the player to wait to the key to be unpressed to be able to press it again...

Thanks in advance...
How is it going
17
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 4th May 2011 07:32
Hey there cHiNo... all you have to do is make a variable

ex:
if( pressing button && variable == 0 )
{
variable = 1;
shoot();
}
if( !pressing button )
variable = 0;

Login to post a reply

Server time is: 2024-10-02 17:21:38
Your offset time is: 2024-10-02 17:21:38