Made kamikaze behavior and also fixed borders

This commit is contained in:
2ndbeam 2024-05-05 18:20:34 +03:00
commit 1ee0b529a8
10 changed files with 41 additions and 44 deletions

View file

@ -5,11 +5,11 @@ extends Node2D
## Shortcut to get_parent()
@onready var ship: Ship = get_parent()
## List of weapons
@onready var list: Array[Node] = get_children() as Array[Node]
@onready var list: Array[Node] = get_children()
## Updates list with actual children of this node
func update_weapon_list() -> void:
list = get_children() as Array[Node]
list = get_children()
## Removes weapon with given ID
func remove_weapon(id: String) -> void:
@ -25,8 +25,8 @@ func add_weapon(_id: String) -> void:
pass
## Returns a reference to weapon with given id if it exists, otherwise returns null
func get_weapon(id: String) -> Weapon:
func get_weapon(id: String) -> Node:
for weapon in list:
if weapon.id == id:
return weapon as Weapon
return weapon
return null