#trying to add a jump ground pound
1 messages · Page 1 of 1 (latest)
so thats a good thing?
No, you want it to start the timer when you hit the ground and for the timer to not get reset every frame, that is why I personally to use “if is_on_floor() and timer.is_stopped():” on line 31, this is because it will only start the timer when you hit the ground. Potential problems for the future: the timer will start every time you are on ground wether you did ground pound or not, a solution to that is to make a way to store if you are in a ground pound and then set it to false as soon as you start the timer, if you need more help, do say.
im confused what to do
What are you confused about specifically
So what i presume you want is that the timer to start once you hit the floor, and to accomplish that, you add another condition on line 31 where you also check if the timer is running (using timer.is_stopped())
Now the timer will only start running once.
(Until the timer times out)
so i do this?
No, you put it in the if statement because you only want the timer to start if it is currently stopped, like this->
If is_on_floor() and timer.is_stopped():
Yes
it only goes when i touch the ground, but it keeps on repeating
i have one shot turned on
Ok, now you want it to only run the timer when they hit ground pound right?
correct
So you could just make a variable that lets call in this example “doing_ground_pound” which will be false in most cases, but whenever the player does the ground pound, it is set to true
Then on line 31, you add another condition checking if “doing_ground_pound” is true
(I will provide full writeup of what i mean in a bit, also the variable can be called whatever you want it to be called)
so the if statement would be -
if is_on_floor() and timer.is_stopped() and doing_ground_pound:
timer.start(0.5)
doing_ground_pound = false
This means that the timer only starts once you do the ground pound and only then
that works
except it keeps repeating after words
wait
didn't add the doing ground pound = false thing yet
now i get this error
wait
i fixed it
It detected a difference in indentation (4 spaces or tab)