I am making a game in which case there is a stop watch that keeps on counting up (in seconds) when the player hits the "E" key. But I am having trouble. Depending on how long the player takes, it will start the stop watch at however long he takes.
Example: If the player takes 10 seconds before pressing E to start the timer, the timer will start at 10 and continue to count up from there
Here is what my code looks like:
Alright, to get input: http://unity3d.com/support/documentation/ScriptReference/Input.html
To get the time in seconds: http://unity3d.com/support/documentation/ScriptReference/Time.html
So, get the start time, get the time they push the button, get the difference between, and then the add that to the time they push the button, and thats the new time they have for the timer to go up...
So put the Input in the update function, and then use the times as I explained above. Pretty easy...
Is their a specific question you have? You don't really specify one.
answered Apr 19 '11 at 04:31 PM
How about just incrementing a timer from the moment the user pressed E?
answered Apr 19 '11 at 04:41 PM