added even more fades
This commit is contained in:
parent
488e3e818e
commit
2cbb6d1414
5 changed files with 80 additions and 19 deletions
4
scenes/ExitScene.gd
Normal file
4
scenes/ExitScene.gd
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
extends ColorRect
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
get_tree().quit(0)
|
12
scenes/ExitScene.tscn
Normal file
12
scenes/ExitScene.tscn
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://scenes/ExitScene.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="ExitScene" type="ColorRect"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
color = Color( 0, 0, 0, 1 )
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
|
@ -29,7 +29,7 @@ func _on_ContinueButton_pressed():
|
||||||
|
|
||||||
|
|
||||||
func _on_ExitButton_pressed():
|
func _on_ExitButton_pressed():
|
||||||
get_tree().quit(0)
|
Transit.change_scene("res://scenes/ExitScene.tscn", 0.2)
|
||||||
|
|
||||||
|
|
||||||
func _on_CreditsButton_pressed():
|
func _on_CreditsButton_pressed():
|
||||||
|
|
|
@ -1,21 +1,40 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
onready var panel := $MarginContainer/Panel
|
||||||
|
onready var background := $Background
|
||||||
|
onready var tween := $Tween
|
||||||
|
|
||||||
|
var animation_speed = 0.4
|
||||||
|
|
||||||
func load_main_menu():
|
func load_main_menu():
|
||||||
Transit.change_scene("res://scenes/MainMenu.tscn", 0.5)
|
Transit.change_scene("res://scenes/MainMenu.tscn", 0.5)
|
||||||
|
|
||||||
|
|
||||||
func pause():
|
func pause():
|
||||||
|
if not get_tree().paused:
|
||||||
get_tree().paused = true
|
get_tree().paused = true
|
||||||
show()
|
show()
|
||||||
|
tween.stop_all()
|
||||||
|
tween.interpolate_property(background, "modulate", null, Color(1, 1, 1, 1), 2*animation_speed/3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||||
|
tween.interpolate_property(panel, "modulate", null, Color(1, 1, 1, 1), animation_speed, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||||
|
tween.start()
|
||||||
|
|
||||||
|
|
||||||
func unpause():
|
func unpause():
|
||||||
|
if get_tree().paused:
|
||||||
get_tree().paused = false
|
get_tree().paused = false
|
||||||
hide()
|
tween.stop_all()
|
||||||
|
tween.interpolate_property(background, "modulate", null, Color(1, 1, 1, 0), animation_speed/2, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||||
|
tween.interpolate_property(panel, "modulate", null, Color(1, 1, 1, 0), animation_speed/2, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
|
||||||
|
tween.start()
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
panel.modulate = Color(1, 1, 1, 0)
|
||||||
|
background.modulate = Color(1, 1, 1, 0)
|
||||||
connect("gui_input", self, '_on_gui_input')
|
connect("gui_input", self, '_on_gui_input')
|
||||||
|
tween.connect("tween_all_completed", self, "_on_Tween_tween_all_completed")
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent):
|
func _input(event: InputEvent):
|
||||||
if event.is_action_pressed("ui_cancel") and visible:
|
if event.is_action_pressed("ui_cancel") and visible:
|
||||||
|
@ -37,3 +56,8 @@ func _on_ContinueButton_pressed():
|
||||||
func _on_MenuButton_pressed():
|
func _on_MenuButton_pressed():
|
||||||
unpause()
|
unpause()
|
||||||
load_main_menu()
|
load_main_menu()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Tween_tween_all_completed():
|
||||||
|
if panel.modulate == Color(1, 1, 1, 0):
|
||||||
|
hide()
|
||||||
|
|
|
@ -1,10 +1,28 @@
|
||||||
[gd_scene load_steps=6 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://scenes/PauseMenu.gd" type="Script" id=1]
|
[ext_resource path="res://scenes/PauseMenu.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://images/pause.png" type="Texture" id=2]
|
[ext_resource path="res://images/pause.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://scenes/typo/Button.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://scenes/typo/Button.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://fonts/open-sans/OpenSans-Light.ttf" type="DynamicFontData" id=4]
|
[ext_resource path="res://fonts/open-sans/OpenSans-Light.ttf" type="DynamicFontData" id=4]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id=3]
|
||||||
|
content_margin_left = 0.0
|
||||||
|
content_margin_right = 0.0
|
||||||
|
content_margin_top = 0.0
|
||||||
|
content_margin_bottom = 0.0
|
||||||
|
bg_color = Color( 0.160784, 0.152941, 0.180392, 1 )
|
||||||
|
border_width_left = 4
|
||||||
|
border_width_top = 4
|
||||||
|
border_width_right = 4
|
||||||
|
border_width_bottom = 4
|
||||||
|
corner_radius_top_left = 10
|
||||||
|
corner_radius_top_right = 10
|
||||||
|
corner_radius_bottom_right = 10
|
||||||
|
corner_radius_bottom_left = 10
|
||||||
|
shadow_color = Color( 0, 0, 0, 0.392157 )
|
||||||
|
shadow_size = 40
|
||||||
|
shadow_offset = Vector2( 10, 10 )
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=1]
|
[sub_resource type="DynamicFont" id=1]
|
||||||
size = 50
|
size = 50
|
||||||
font_data = ExtResource( 4 )
|
font_data = ExtResource( 4 )
|
||||||
|
@ -22,7 +40,7 @@ __meta__ = {
|
||||||
[node name="Background" type="ColorRect" parent="."]
|
[node name="Background" type="ColorRect" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
color = Color( 0, 0, 0, 0.196078 )
|
color = Color( 0, 0, 0, 0.27451 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
@ -30,6 +48,7 @@ __meta__ = {
|
||||||
[node name="BackgroundButton" type="TextureButton" parent="."]
|
[node name="BackgroundButton" type="TextureButton" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
mouse_default_cursor_shape = 2
|
||||||
expand = true
|
expand = true
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
|
@ -47,14 +66,14 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="MarginContainer"]
|
[node name="Panel" type="Panel" parent="MarginContainer"]
|
||||||
margin_left = 400.0
|
margin_left = 400.0
|
||||||
margin_top = 100.0
|
margin_top = 100.0
|
||||||
margin_right = 1520.0
|
margin_right = 1520.0
|
||||||
margin_bottom = 980.0
|
margin_bottom = 980.0
|
||||||
color = Color( 0.164706, 0.180392, 0.196078, 1 )
|
custom_styles/panel = SubResource( 3 )
|
||||||
|
|
||||||
[node name="MarginContainer2" type="MarginContainer" parent="MarginContainer/ColorRect"]
|
[node name="MarginContainer2" type="MarginContainer" parent="MarginContainer/Panel"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
custom_constants/margin_right = 50
|
custom_constants/margin_right = 50
|
||||||
|
@ -65,7 +84,7 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ColorRect/MarginContainer2"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/Panel/MarginContainer2"]
|
||||||
margin_left = 50.0
|
margin_left = 50.0
|
||||||
margin_top = 50.0
|
margin_top = 50.0
|
||||||
margin_right = 1070.0
|
margin_right = 1070.0
|
||||||
|
@ -74,17 +93,17 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/ColorRect/MarginContainer2/VBoxContainer"]
|
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/Panel/MarginContainer2/VBoxContainer"]
|
||||||
margin_right = 1020.0
|
margin_right = 1020.0
|
||||||
margin_bottom = 64.0
|
margin_bottom = 64.0
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="MarginContainer/ColorRect/MarginContainer2/VBoxContainer/CenterContainer"]
|
[node name="TextureRect" type="TextureRect" parent="MarginContainer/Panel/MarginContainer2/VBoxContainer/CenterContainer"]
|
||||||
margin_left = 478.0
|
margin_left = 478.0
|
||||||
margin_right = 542.0
|
margin_right = 542.0
|
||||||
margin_bottom = 64.0
|
margin_bottom = 64.0
|
||||||
texture = ExtResource( 2 )
|
texture = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="Text" type="Label" parent="MarginContainer/ColorRect/MarginContainer2/VBoxContainer"]
|
[node name="Text" type="Label" parent="MarginContainer/Panel/MarginContainer2/VBoxContainer"]
|
||||||
margin_top = 68.0
|
margin_top = 68.0
|
||||||
margin_right = 1020.0
|
margin_right = 1020.0
|
||||||
margin_bottom = 724.0
|
margin_bottom = 724.0
|
||||||
|
@ -94,26 +113,28 @@ text = "Le jeu est en pause"
|
||||||
align = 1
|
align = 1
|
||||||
valign = 1
|
valign = 1
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/ColorRect/MarginContainer2/VBoxContainer"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/Panel/MarginContainer2/VBoxContainer"]
|
||||||
margin_top = 728.0
|
margin_top = 728.0
|
||||||
margin_right = 1020.0
|
margin_right = 1020.0
|
||||||
margin_bottom = 780.0
|
margin_bottom = 780.0
|
||||||
custom_constants/separation = 50
|
custom_constants/separation = 50
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="MenuButton" parent="MarginContainer/ColorRect/MarginContainer2/VBoxContainer/HBoxContainer" instance=ExtResource( 3 )]
|
[node name="MenuButton" parent="MarginContainer/Panel/MarginContainer2/VBoxContainer/HBoxContainer" instance=ExtResource( 3 )]
|
||||||
margin_left = 355.0
|
margin_left = 355.0
|
||||||
margin_top = 0.0
|
margin_top = 0.0
|
||||||
margin_right = 455.0
|
margin_right = 455.0
|
||||||
margin_bottom = 52.0
|
margin_bottom = 52.0
|
||||||
text = "Menu"
|
text = "Menu"
|
||||||
|
|
||||||
[node name="ContinueButton" parent="MarginContainer/ColorRect/MarginContainer2/VBoxContainer/HBoxContainer" instance=ExtResource( 3 )]
|
[node name="ContinueButton" parent="MarginContainer/Panel/MarginContainer2/VBoxContainer/HBoxContainer" instance=ExtResource( 3 )]
|
||||||
margin_left = 505.0
|
margin_left = 505.0
|
||||||
margin_top = 0.0
|
margin_top = 0.0
|
||||||
margin_right = 664.0
|
margin_right = 664.0
|
||||||
margin_bottom = 52.0
|
margin_bottom = 52.0
|
||||||
text = "Continuer"
|
text = "Continuer"
|
||||||
|
|
||||||
|
[node name="Tween" type="Tween" parent="."]
|
||||||
[connection signal="pressed" from="BackgroundButton" to="." method="_on_BackgroundButton_pressed"]
|
[connection signal="pressed" from="BackgroundButton" to="." method="_on_BackgroundButton_pressed"]
|
||||||
[connection signal="pressed" from="MarginContainer/ColorRect/MarginContainer2/VBoxContainer/HBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
|
[connection signal="pressed" from="MarginContainer/Panel/MarginContainer2/VBoxContainer/HBoxContainer/MenuButton" to="." method="_on_MenuButton_pressed"]
|
||||||
[connection signal="pressed" from="MarginContainer/ColorRect/MarginContainer2/VBoxContainer/HBoxContainer/ContinueButton" to="." method="_on_ContinueButton_pressed"]
|
[connection signal="pressed" from="MarginContainer/Panel/MarginContainer2/VBoxContainer/HBoxContainer/ContinueButton" to="." method="_on_ContinueButton_pressed"]
|
||||||
|
|
Loading…
Reference in a new issue