Hi guys,
I'm trying make a golf style game where the player will hold down the left mouse button in order to charge their shot. When they release the button, the ball will be hit with a force calculated from the length of time the button was held down.
Does anyone have any tips on how to do this?
I currently have an FSM with 3 states:
1. Idle - Waiting for the left mouse button to be pressed down
2. Charging - Activated as soon as the button is pressed and ending when the button is released
3. Shot - Activated as soon as the button is released.
The contents so far are pretty empty, what I've described above works. I just need to understand how I get the FSM to measure the amount of time the button is held for and store that as a variable which will then become a physical force for the shot.
Any help would be greatly appreciated.
Thanks.