Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | CrisCros |
extends KinematicBody2D
var speed=15
var jumpForce=450
var gravity=800
var vel=Vector2()
onready var playerImage=get_node(“player”)
func _physics_process(delta):
if Input.is_action_pressed(“ui_right”):
vel.x+=speed
elif Input.is_action_pressed(“ui_left”):
vel.x-=speed
else:
vel.x=0
vel.y+=gravity*delta
vel=move_and_slide(vel,Vector2.UP)
if vel.x<0:
playerImage.flip_h=true
if vel.x>0:
playerImage.flip_h=false
if Input.is_action_pressed("ui_up") and is_on_floor():
vel.y-=jumpForce
Animate()
func Animate():
var anim=“idle”
if vel.x!=0:
anim=“run”
if $player.animation!=anim:
$player.
Could you explain your question a bit more? I also don’t think you included the part where your player moves in your post.
SweetPie | 2022-10-21 00:37