This repository has been archived on 2022-03-31. You can view files and clone it, but cannot push or open issues or pull requests.
Tyra/scripts/menuPrincipal.gd

20 lines
787 B
GDScript3
Raw Normal View History

2021-04-08 02:31:29 +02:00
extends Node2D
2021-04-08 03:02:23 +02:00
func _ready(): # focus par défaut le bouton JOUER
2021-04-08 02:31:29 +02:00
$MarginContainer/VBoxContainer/VBoxContainer/Jouer.grab_focus()
2021-04-08 15:15:37 +02:00
global.monde = 0
global.ennemisTues = 0
2021-04-08 02:31:29 +02:00
2021-04-08 03:02:23 +02:00
func _physics_process(_delta): # gestion de la souris
2021-04-08 02:31:29 +02:00
if $MarginContainer/VBoxContainer/VBoxContainer/Jouer.is_hovered() == true:
$MarginContainer/VBoxContainer/VBoxContainer/Jouer.grab_focus()
if $MarginContainer/VBoxContainer/VBoxContainer/Quitter.is_hovered() == true:
$MarginContainer/VBoxContainer/VBoxContainer/Quitter.grab_focus()
func _on_Jouer_pressed():
2021-04-08 19:45:53 +02:00
if get_tree().change_scene("res://scenes/Monde%s.tscn" % global.randomMap()) != OK: # on charge le monde
2021-04-08 03:02:23 +02:00
print("Impossible de charger le jeu.") # si le monde n'a pas chargé
2021-04-08 02:31:29 +02:00
func _on_Quitter_pressed():
2021-04-08 03:02:23 +02:00
get_tree().quit() # quitte le jeu