Indeed that is usefull. But being a newb i cant use it that well yet.
What i want to do, as stated above, is:
"when hes jumping hes going up with a constant speed. It would be much better if he started fast and the slowed down ONLY when he reaches max altitude!"
If you could help me with this I would be very thankfull!
Thank you for your help until now!
Edit:
My gravity is 7 and because the negative numbers go up it cant be less then 0
I'll just show you
extends KinematicBody2D
const UP = Vector2(0, -100)
const ACCELERATION = 500
const MAX_SPEED = 800
var motion = Vector2()
var GRAVITY= 20
func _physics_process(delta):
var FRICTION = false
if Input. is_action_pressed("ui_right"):
motion.x = min(motion.x + ACCELERATION, MAX_SPEED)
$player.flip_h = false
$player.play("default")
elif Input. is_action_pressed("ui_left"):
motion.x = max(motion.x - ACCELERATION, -MAX_SPEED)
$player.flip_h = true
$player.play("default")
else:
motion.x = lerp(motion.x, 0, 0.1)
FRICTION = false
$player.play("default")
motion.y += 7
if is_on_floor():
if Input. is_action_just_pressed("ui_up"):
motion.y = -450
else:
if motion.y < 0:
$player.play("jump")
else:
$player.play("fall")
motion.y += GRAVITY
move_and_slide(motion, UP)
pass