0 votes
var vel = Vector2()

var speed = 200
var jump = 1000
const gravity = 500
const FLOOR = Vector2(0, -1)

func physicsprocess(delta):
if Input. isactionpressed("playerleft"):
vel.x = -speed
elif Input. is
actionpressed("playerright"):
vel.x = speed
else:
vel.x = 0

if Input. is_action_pressed("player_jump"):
    vel.y = -jump


vel.y = gravity

move_and_slide(vel)
in Engine by (12 points)

1 Answer

0 votes

Try

vel = move_and_slide(vel, Vector2.UP)

also vel.y += gravity and put it way lower, should do the trick.

by (46 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.