Godot Version
V4.2.2
Question
I’m trying to make an attacking dive something like Mario 64 where you go forward at a big speed and stuff. My one issue is that I can’t figure out how to make the horizontal movement on the X axis. I would use a “repeat” loop but I don’t know if Godot has any of those so I’m kind of stuck now. Here’s what I have so far:
func lunge(input_axis, delta):
if Input.is_action_just_pressed(“attack”):
velocity.y = -300
(the horizontal movement I can’t figure out)
Try doing it inside _physics_process
.
This method is executed every frame so you can keep updating your velocity.y
.
It’s the velocity.x that I’m needing to change, and the _physics_process wouldn’t exactly help because I need to manually decide how many times to run the “velocity.x += 50”
Oh I’m sorry, my bad hehe
Hmm, in this case u could keep adding it until it hits something and on collision update a bool that will stop de the velocity.x increase.
Maybe I didn’t helped u as much as I wanted, but here is an example of for loop in GDScript that you mentioned:
for x in 10:
print(x)
1 Like