Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | rgregre |
im new to godot just started learning , i tried to make a movement for the player but the scrips always runs the last if statlment ignoring the rest before
this is the scritp i had
extends KinematicBody2D
export(int) var speed = 100
var movement_direction := Vector2.ZERO
func _process(delta):
if Input.is_action_pressed("right"):
movement_direction.x=1
if Input.is_action_pressed("left"):
movement_direction.x=-1
movement_direction = movement_direction.normalized()
move_and_slide(movement_direction*speed)
In future, when pasting code here, use the “Code Sample” button to format it correctly.
kidscancode | 2021-09-04 00:15