Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Ingword |
H!
I’m trying to combine a jump and a move to the right from the spot. But now it turns out only a micromovement to the right and a jump after that. Tell me, please, how to make the character jump forward and right (like a parabola) when you press the button up?
Godot 3.1
extends KinematicBody2D
var speed = 200
var gravity = 970
var ground = Vector2(0, -1)
var jump_power = 500
var velocity = Vector2()
func _physics_process(delta):
velocity.y += gravity * delta
velocity = move_and_slide(velocity, ground)
if Input.is_action_just_pressed("ui_up") && is_on_floor():
velocity.y = jump_power
velocity.x = speed