AutoFire ?

Started by BooBoo, October 22, 2008, 11:59:58 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BooBoo

Hi - Im trying to write a little game and not sure if im gonna use KeyBoard or Joystick but weather I use Inkey$ or Fire(1) holding down the button results in an autofire afect that i dont want is there a way around this Ive tryed Key Speed but this throws my Left and Right controls out and is keyboard only.

SamuraiCrow

Some game that I have played just wait until the fire button on the joystick is released before it actually does anything.  Maybe that might be an easier approach.

Relying on key repeating doesn't seem like a reliable way to do it.

BooBoo

Thanks for your reply Well its a beat em up so Fire results in contious punches or punch once the buttons released?

SamuraiCrow

Wow, I didn't know that about Amos.  I'd only seen the fi command on UNIX shell scripts so I didn't expect it here.

BTW, the code tags are activated by a button with a '#' symbol on it.  (Whatever that means.)

tarantino88

If you only want 1 fire to happen you should check for a flag around your fire (1) check, I would be lazy and make this a integer.
E.g.
If flag =0
flag=1 : rem this stops us coming in on next loop
If fire(1) = true
...
...
Rem your code
...
...
End if
End if

Initialise flag=0
You then need to set flag back to 0 when your animation or movement has finished (I'm assuming you are checking for this somewhere)

I've not tested the code in AMOS so there may be syntax errors, but hopefully you understand the principal behind it.