Hi all

I'm following a tutorial on youtube to make projectiles. Like with 99.94% of all tutorials in existence, it's for previous versions of Godot which can vary drastically between versions. I'm around 30 mins in, and I can't make my projectiles move.

I had this problem months ago with my character, and somehow eventually figured it all out using the official documentation and a lot of trial and error. I can't for the life of me work it out atm, can someone help?

Here is the code on my projectile

extends CharacterBody2D

var direction = 1
var projectile_velocity = Vector2()
const SPEED = 5000

func _ready():
	projectile_velocity.x = SPEED * direction

func _physics_process(_delta):
	if is_on_floor():
		queue_free()

	move_and_slide()
  • retroshark replied to this.
  • fnanfne Hey! move_and_slide() doesn't recognize your custom variable for velocity. Try using the velocity keyword instead.

    fnanfne Hey! move_and_slide() doesn't recognize your custom variable for velocity. Try using the velocity keyword instead.

      retroshark Thanks! Your code worked but the projectile still wasn't moving. I realised the collision shape of the character interfered with the projectile traversing. Got it working now, thanks again!