Hi, i’m new to game dev so i followed a tutorial https://www.youtube.com/watch?v=1TU2X37wPes and idk why nothing work, i tried to use basic player mouvement template but don’t work either, my sprites can’t move
here my scripts :
extends CharacterBody2D
@export var movement_speed : float = 500
var character_direction : Vector2
Aha! That is indeed weird, nothing in the code you posted should do that… I couldn’t tell because I can’t see in the video what keys are being pressed.
Are there any other scripts in your project? Can you show a screenshot of your scene tree?
update : i made a new code to try if it work, no it get the same problem, i think godot bug, if it can help i use linux mint with the kernel version : Linux 5.15.0-117-generic x86_64
extends CharacterBody2D
@export var mouvement_speed : float = 500
var character_direction : Vector2
var screen_size
func _ready():
pass
func _physics_process(delta):
velocity = Vector2.ZERO # The player's movement vector.
# Movement input
if Input.is_action_pressed("right"):
velocity.x += 1
if Input.is_action_pressed("left"):
velocity.x -= 1
if Input.is_action_pressed("backward"):
velocity.y += 1
if Input.is_action_pressed("forward"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * mouvement_speed
move_and_slide()
Looks like you have nothing else in the scene, your player is moving, and the camera follows them so it looks like nothing is happening. Add anything else to the scene beside the player