1
General / How can I make it so they can't hold down a button and spam?
« on: May 25, 2010, 01:49:30 am »Quote from: "Kingdom of Fish"
Or you can switch to using events.
I'd like to switch to events, but I tried that and there is only a small delay in shooting. Instead of it spamming nonstop, its *shoot shoot shoot* *slight delay* *shoot shoot shoot*
This is the code I have for events:
Code: [Select]
sf::Event Event;
while (App.GetEvent(Event)) {
if ( Event.Key.Code == sf::Key::Space ) {
sf::Sprite Missle(MissileImage);
Missile.SetPosition(Player.GetPosition());
Missile.SetRotation(Player.GetRotation());
missiles.push_back(Missile);
}
}