When the user presses the enter button, the space ship shoots a bullet. I have made it so that it restricts the actions for 00.10 seconds. It takes much longer than 00.10 seconds to shoot. Why is this? How can I fix it?
When the user presses the enter button, the space ship shoots a bullet. I have made it so that it restricts the actions for 00.10 seconds. It takes much longer than 00.10 seconds to shoot. Why is this? How can I fix it?





Hard to say without seeing the coding. How much longer does it take?
Ah, are you using the mouse with Fire being the mouse button? If so, I've noticed that when the mouse is not moved and you rapidly click the mouse button, MMF is a bit slower to register the clicks compared to when the mouse is moving. That might be the issue but if it is, I don't know how to get around it.
KnightTrek Productions
http://www.knighttrek.com
http://mmfgamer5.googlepages.com/SpaceInvaders.mfa
The file is above
Just tested your code and I would imagine that it's the restrict command that's doing it.
Why are you restricting the fire command?
If you only want the player to be able to fire one bullet at a time, then try checking for zero bullets as the second condition instead of the restrict command, so that it will only fire when there are no other bullets active.
Or if you do wan't multiple bullets with a 0.10 delay between them, then use "every 0.10" followed by the "upon pressing Enter" command.
This gives you a nice stream of bullets, but makes it a bit too easy.
I've just tried both methods with your code, and they work fine.
Krush.
i want it to fire like it would in the real games. so a short delay inbetween each one.



When you fire have this:
On fire & alterable value a = 0 ->
Set alterable value a to 1
alterable value a is >= 1
Add to alterable value a 1
alterable value a is >= 200
Set alterable value a to 0
That will delay the shot, change 200 to whatever feels right for the game.


That's a good example, but it would delay the shot after the button is pressed. I'd rather change it to
Alterable Value A = Greater than 200 + upon pressing "shoot" -> shoot and set Alterable Value A to 0.
Edit: Oh, and of course:
Every 00.01 -> Add 1 to Alterable Value A.
The original Space Invaders only allowed one shot, and wouldn't allow another until that bullet was destroyed.
To be exact, it wouldn't allow another shot until the animation of the bullet exploding had finished.
At least on the default dip switch settings anyway.
So, to get the same gameplay as the original Invaders,add an explosion animation to your bullet active object, and use the method I described a few posts ago to check for the number of bullets alive, like so:
Upon Pressing "Enter"
+ Number of (bullets)=0
and seeing as the bullet won't actually be destroyed until the "destroy" animation has finished, you'll have bullets that will act just as the original did.
For your specific example, you should add code to destroy the missile if it leaves the edge of the screen, for the times when you miss the invaders completely, so that you can fire again when the bullet leaves the screen at the top.
Krush.
Thanks Krush_Brother! Now it works! The game should be out soon