Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
Handling time to delay?
Print
Pages: [
1
]
Author
Topic: Handling time to delay? (Read 2573 times)
0 Members and 1 Guest are viewing this topic.
Jimicro
Newbie
Posts: 31
Handling time to delay?
«
on:
January 09, 2011, 08:33:29 pm »
Hi all.
I have a little game with a shooting feature I want to hold down a button to shoot but I donĀ“t want it to shoot all the time, so can I use sf::Clock to just make it wait between all generating shots?
Logged
Groogy
Hero Member
Posts: 1469
Handling time to delay?
«
Reply #1 on:
January 09, 2011, 08:39:18 pm »
Depends entirely on how you design the game. For optimal you would probably only want one clock in the entire game. But using several clocks for something like that will work too
Logged
Developer and Maker of
rbSFML
and Programmer at
Paradox Development Studio
Nexus
SFML Team
Hero Member
Posts: 6287
Thor Developer
Handling time to delay?
«
Reply #2 on:
January 10, 2011, 02:44:08 pm »
You can also measure the frame time using
this
method, and subtract it from a float counter. When the value gets below zero, reset it and perform your action (e.g. fire a bullet).
Logged
Zloxx II
: action platformer
Thor Library
: particle systems, animations, dot products, ...
SFML Game Development
:
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
Handling time to delay?