ape-ame/Gun.gd

11 lines
254 B
GDScript3
Raw Normal View History

2024-04-16 20:29:45 -04:00
extends Marker2D
@export var bullet: PackedScene
func shoot():
2024-04-17 17:22:29 -04:00
#print("Shooting")
2024-04-16 20:29:45 -04:00
var node = bullet.instantiate()
node.global_position = global_position
node.linear_velocity = Vector2(500, 0).rotated(global_rotation)
$/root/Node2D.add_child(node)