#trying to add a jump ground pound

1 messages · Page 1 of 1 (latest)

torpid ferry
#

Continuing on, what currently is happening is that it is constantly restarting the timer until you jump, where you are no longer on the ground and the timer is let to start running

high venture
#

so thats a good thing?

torpid ferry
#

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.

high venture
#

im confused what to do

torpid ferry
#

What are you confused about specifically

high venture
#

what to write

#

where to write

torpid ferry
#

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)

high venture
#

so i do this?

torpid ferry
#

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():

high venture
#

if is_on_floor() and timer.is_stopped():
timer.start(0.5)

#

right?

torpid ferry
#

Yes

high venture
#

it only goes when i touch the ground, but it keeps on repeating

#

i have one shot turned on

torpid ferry
#

Ok, now you want it to only run the timer when they hit ground pound right?

high venture
#

correct

torpid ferry
#

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

high venture
#

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

torpid ferry
#

It detected a difference in indentation (4 spaces or tab)

high venture
#

i accidentally put and _ infront of ground_pounding

#

now, time to figure out how to make it jump higher