func _physics_process(delta):
var collision_info = move_and_collide(velo.normalized() * delta * speed)
lafycek this is godot 3 code. are you using godot 3?
lafycek var laser = laser_scene.instantiate()
and this is godot 4 code. huh
please post screenshots of the error messages?
lafycek extends CharacterBody2D
@export var speed = 600
var velo = Vector2(1,0)
@export var maker = 0
func _physics_process(delta):
var collision_info = move_and_collide(velo.normalized() * delta * speed)
your projectile is a characterbody, and you never tell it which direction to go.
where did you get this code? did you write it yourself or is it from some tutorial?
the structure of this code is odd and... bad.
but to give the laser a direction you would have to first add a parameter to the signal:
laser_shot(laser_scene, location, direction)
then give it a direction the player is facing in shot():
func shoot():
laser_shot.emit(laser_scene, marker_2d.global_position, direction)
and then change velo.x when instantiating the scene in game.gd:
func _on_character_body_2d_laser_shot(laser_scene, location, direction):
var laser = laser_scene.instantiate()
laser.global_position = location
lasery.add_child(laser)
velo.x = direction