2048-Shooter/Slot.gd
2022-11-24 16:00:50 +01:00

25 lines
470 B
GDScript

extends Panel
var PanzerType = preload("res://Panzer.tscn")
var Panzer = null
func _ready():
if randi() % 2 == 0:
Panzer = PanzerType.instance()
add_child(Panzer)
func pickFromSlot():
remove_child(Panzer)
var GameNode = find_parent("Game")
GameNode.add_child(Panzer)
Panzer = null
func putIntoSlot(new_panzer):
Panzer = new_panzer
Panzer.position = Vector2(64, 64)
var GameNode = find_parent("Game")
GameNode.remove_child(Panzer)
add_child(Panzer)