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

19 lines
725 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 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 03:02:23 +02:00
if get_tree().change_scene("res://scenes/Monde1.tscn") != OK: # on charge le monde
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