I’m trying to get my guy to move. I’ve successfully coded the “dodge the creeps” tutorial game. everything worked. I created a new project and started copying things over. I’m just trying to make my guy move, like in mario, left and right. I’ve set up my input mapping, copied the Input.is_action_pressed code for left and right from “dodge the creeps” even made my own custom sprites! the player (area2D) note is instanced in the World node. I dont know what i dont know but i do know its not working. the only clue i have is that, when i run the game i get a yellow error in the debugger saying ‘The parameter “delta” is never used in the function “_process()”…’ but this is untrue. underneath the IF statements for the movement i have “position += velocity * delta” which is another copy from the “dodge the creeps”. please help, i just want my little guy to move
Would be helpful to see more of your code, if you want to paste that feel free.
But you’re using velocity and updating the position manually. Seems like you should pick one or the other.
If you want to do more to try to solve this on your own. Have it print some of those values! print(velocity) may show you you’re not getting anything added to the velocity in the first place.
But either way, we’d have to see some of your code to help much more than that.
Called every frame. ‘delta’ is the elapsed time since the previous frame.
func _process(delta):
var velocity = Vector2.ZERO #players movement vector
if Input.is_action_pressed(“Move_Right”):
velocity.x += 1
if Input.is_action_pressed(“Move_Right”):
velocity.x -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.stop()
position += velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)
if velocity.x !=0:
$AnimatedSprite2D.animation = "run"
$AnimatedSprite2D.flip_h = velocity.x < 0
else:
$AnimatedSprite2D.animation = "idle"
func start(pos):
position = pos
show()
$CollisionShape2D.disabled = false
and then the world node
extends Node
var speed = 400
Called when the node enters the scene tree for the first time.
…so uhh, i just opened a new project… made a character body2D, added my input map, a static body for the floor aaaand it moves. i still have no idea what i did wrong with the area2D. if you can see in clearly in this code or you’d like to dig into it for fun please feel free! but i got it working by restarting and doing it entirely differently. ¯_(ツ)_/¯