Chest + Door Functionality
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
extends Node2D
|
||||
|
||||
onready var coin = preload("res://Levels/Interactives/Coin.tscn")
|
||||
onready var coin_container = get_node("/coin_container")
|
||||
|
||||
onready var coin_container = get_node("coin_container")
|
||||
onready var score_label = get_node('Level 3 HUD/Label')
|
||||
#have event for timer to run out
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ var score = 0
|
||||
func _ready() -> void:
|
||||
$YSort/Player.load_hud($HUD)
|
||||
screensize = get_viewport_rect().size
|
||||
spawn_coins(5)
|
||||
spawn_coins(8)
|
||||
return
|
||||
|
||||
|
||||
@@ -27,3 +27,26 @@ func spawn_coins(num):
|
||||
func _on_coin_grabbed():
|
||||
score+=1
|
||||
print(score)
|
||||
score_label.set_text(str(score) + "/5")
|
||||
|
||||
func _timer_out():
|
||||
get_tree().change_scene('res://Levels/Hub World.tscn')
|
||||
|
||||
|
||||
func _on_TreasureChest_ice_key_collected() -> void:
|
||||
$YSort/Door/doorClosed.visible = false
|
||||
$YSort/Door/doorOpened.visible = true
|
||||
$YSort/DoorCollision.layers = 5
|
||||
|
||||
|
||||
|
||||
func _on_DoorDetector_body_entered(body: Node) -> void:
|
||||
if body.get_parent().name == 'Player':
|
||||
print('WIN WIN WIN')
|
||||
get_tree().change_scene('res://Levels/Hub World.tscn')
|
||||
|
||||
|
||||
func _on_DoorDetector_area_entered(area: Area2D) -> void:
|
||||
if area.get_parent().name == 'Player':
|
||||
print('WIN WIN WIN')
|
||||
get_tree().change_scene('res://Levels/Hub World.tscn') # Replace with function body.
|
||||
|
Reference in New Issue
Block a user