Cow_Life_Sim_RPG/Objects/Arcade/Machines/FlappyCow/FlappyCowMachine.gd

30 lines
1.1 KiB
GDScript

extends Interaction
func _ready():
add_action("Play", play_game)
var nestedGameInstance
func play_game():
if !get_node("/root/MainGame/CanvasLayer/MenuBar").visible:
return
get_node("/root/MainGame/CanvasLayer/MessageZone").visible = false
get_node("/root/MainGame/CanvasLayer/MenuBar").visible = false
get_node("/root/MainGame/CanvasLayer/MinimizeMessageZoneButton").visible = false
var nestedGameScene = preload("res://MiniGames/FlappyCow/World/World.tscn")
nestedGameInstance = nestedGameScene.instantiate()
find_parent("MainGame").add_child(nestedGameInstance)
nestedGameInstance.get_node("FlappyCow").get_node("Camera2D").make_current()
#get_tree().paused = true
# minigame just breaks if you pause but the otherone doesnt idk why
func test_game(): #for testing minigames before they get placed in the world
get_node("/root/MainGame/CanvasLayer/MessageZone").visible = false
var nestedGameScene = preload("res://MiniGames/RingToss/ringtoss_scene.tscn")
nestedGameInstance = nestedGameScene.instantiate()
find_parent("MainGame").add_child(nestedGameInstance)
nestedGameInstance.get_node("RTcam").make_current()
get_tree().paused = true