From 2945f2a3ef8d0798ec3866ebff61f0b237bbda3a Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 25 Feb 2023 18:46:29 +0100 Subject: [PATCH] add gameover --- Assets/skin_assets/menu_font.tres | 8 ++++++++ Scenes/Button_Node2D.gd | 8 ++------ Scenes/gameover.tscn | 20 ++++++++++++++++++++ Scenes/menu.tscn | 15 +++++---------- 4 files changed, 35 insertions(+), 16 deletions(-) create mode 100755 Assets/skin_assets/menu_font.tres create mode 100755 Scenes/gameover.tscn diff --git a/Assets/skin_assets/menu_font.tres b/Assets/skin_assets/menu_font.tres new file mode 100755 index 0000000..6e74eda --- /dev/null +++ b/Assets/skin_assets/menu_font.tres @@ -0,0 +1,8 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://Assets/skin_assets/VCR_OSD_MONO_1.001.ttf" type="DynamicFontData" id=1] + +[resource] +size = 34 +outline_color = Color( 0.298039, 0.0745098, 0.0745098, 1 ) +font_data = ExtResource( 1 ) diff --git a/Scenes/Button_Node2D.gd b/Scenes/Button_Node2D.gd index ea56319..7abdc11 100755 --- a/Scenes/Button_Node2D.gd +++ b/Scenes/Button_Node2D.gd @@ -11,12 +11,8 @@ const texture_released = preload("res://Assets/skin_assets/button_pressed.png") # Called every frame. '_delta' is the elapsed time since the previous frame. func _process(_delta): if etat: - if villain.animation == villain_animations[1]: - print("non") - else: - print("oui") - else: - print("caché") + if villain.animation == villain_animations[-1]: + get_tree().change_scene("res://Scenes/gameover.tscn") func _on_Button_pressed(): diff --git a/Scenes/gameover.tscn b/Scenes/gameover.tscn new file mode 100755 index 0000000..41420bc --- /dev/null +++ b/Scenes/gameover.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Assets/windows.png" type="Texture" id=1] +[ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=2] + +[node name="Node2D" type="Node2D"] + +[node name="Windows" type="Sprite" parent="."] +position = Vector2( 512, 360 ) +z_index = -2 +texture = ExtResource( 1 ) + +[node name="Label" type="Label" parent="."] +margin_left = 393.0 +margin_top = 329.0 +margin_right = 693.0 +margin_bottom = 359.0 +custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = ExtResource( 2 ) +text = "RATIO GAME OVER" diff --git a/Scenes/menu.tscn b/Scenes/menu.tscn index 6e757b4..483276f 100755 --- a/Scenes/menu.tscn +++ b/Scenes/menu.tscn @@ -1,17 +1,12 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://Assets/windows.png" type="Texture" id=1] -[ext_resource path="res://Assets/skin_assets/VCR_OSD_MONO_1.001.ttf" type="DynamicFontData" id=2] +[ext_resource path="res://Assets/skin_assets/menu_font.tres" type="DynamicFont" id=2] [ext_resource path="res://Assets/tres_button/hover.tres" type="StyleBox" id=3] [ext_resource path="res://Assets/tres_button/normal.tres" type="StyleBox" id=4] [ext_resource path="res://Assets/tres_button/pressed.tres" type="StyleBox" id=5] [ext_resource path="res://Scenes/Screen_Menu.gd" type="Script" id=6] -[sub_resource type="DynamicFont" id=1] -size = 34 -outline_color = Color( 0.298039, 0.0745098, 0.0745098, 1 ) -font_data = ExtResource( 2 ) - [node name="Node2D" type="Node2D"] [node name="Windows" type="Sprite" parent="."] @@ -38,7 +33,7 @@ alignment = 1 margin_right = 100.0 margin_bottom = 37.0 custom_colors/font_color = Color( 0.34902, 0.313726, 0.313726, 1 ) -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = ExtResource( 2 ) custom_styles/hover = ExtResource( 3 ) custom_styles/pressed = ExtResource( 5 ) custom_styles/normal = ExtResource( 4 ) @@ -49,7 +44,7 @@ margin_top = 63.0 margin_right = 100.0 margin_bottom = 100.0 custom_colors/font_color = Color( 0.34902, 0.313726, 0.313726, 1 ) -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = ExtResource( 2 ) custom_styles/hover = ExtResource( 3 ) custom_styles/pressed = ExtResource( 5 ) custom_styles/normal = ExtResource( 4 ) @@ -60,7 +55,7 @@ margin_top = 126.0 margin_right = 100.0 margin_bottom = 163.0 custom_colors/font_color = Color( 0.34902, 0.313726, 0.313726, 1 ) -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = ExtResource( 2 ) custom_styles/hover = ExtResource( 3 ) custom_styles/pressed = ExtResource( 5 ) custom_styles/normal = ExtResource( 4 )