I dont know why but the bullet doesn
t spawn in it`s position correctly
projectile script
extends Area2D
var travelled = 0
func _physics_process(delta) :
const SPEED = 500
const RANGE = 1200
global_position.x += -1 * SPEED * delta
travelled += 1
if travelled == RANGE:
queue_free()
func _on_body_entered(body) :
queue_free()
if body.has_method("damage_taken"):
body.damage_taken()
###Cannon script
extends StaticBody2D
func shoot():
const BULLET = preload("res://scenes/projectile.tscn")
var bullet_spawn = BULLET.instantiate()
bullet_spawn.global_position.x = %point.global_position.x
##bullet_spawn.global_rotation.x = %point.global_rotation.x
%point.add_child(bullet_spawn)
func _on_timer_timeout() -> void:
shoot()