mirror of
https://github.com/Yadciel1/2048-Shooter.git
synced 2024-12-26 14:57:02 +01:00
13394479bd
Slots can update, other scaling
56 lines
1.1 KiB
GDScript
56 lines
1.1 KiB
GDScript
extends Panel
|
|
|
|
var PanzerType = preload("res://Objects/Panzer.tscn")
|
|
var Panzer = null
|
|
var level = 0
|
|
var start_panzer = 0
|
|
|
|
func _process(delta):
|
|
check_level()
|
|
if start_panzer > 0:
|
|
if randi() % 2 == 0:
|
|
Panzer = PanzerType.instance()
|
|
add_child(Panzer)
|
|
start_panzer -= 1
|
|
|
|
|
|
func pickFromSlot():
|
|
remove_child(Panzer)
|
|
var GameNode = find_parent("Game")
|
|
GameNode.add_child(Panzer)
|
|
Panzer = null
|
|
|
|
func putIntoSlot(new_panzer):
|
|
if level != 0 and new_panzer.old_slot == null:
|
|
if new_panzer.PanzerType != null:
|
|
new_panzer.PanzerType += 1
|
|
else:
|
|
new_panzer.PanzerType = 2
|
|
Panzer = new_panzer
|
|
Panzer.position = Vector2(64, 64)
|
|
var GameNode = find_parent("Game")
|
|
GameNode.remove_child(Panzer)
|
|
add_child(Panzer)
|
|
|
|
func upgradePanzerInSlot():
|
|
Panzer.hit_power *= 2
|
|
Panzer.PanzerType += 1
|
|
pass
|
|
|
|
func _set_start_panzer(value):
|
|
start_panzer += value
|
|
|
|
|
|
func _on_slotshape_area_entered(area):
|
|
if area.is_in_group("Panzer"):
|
|
var GameNode = find_parent("Game")
|
|
if GameNode.holding_item != null:
|
|
GameNode.hover = self
|
|
pass # Replace with function body.
|
|
|
|
|
|
func check_level():
|
|
if level == 1:
|
|
modulate = Color(1, 0.984375, 0)
|
|
pass
|