[EDIT] finished end game window

This commit is contained in:
baldas_h 2020-04-04 21:22:13 +02:00
parent 26def16bcf
commit 9bae75a55a
6 changed files with 66 additions and 31 deletions

View File

@ -1,14 +1,14 @@
extends Control
func show():
func showEndGameWindow(playerName):
get_tree().paused = true
self.visible = true
get_node("/root/World/CanvasLayer/Window/ColorRect/WinnerName").text = playerName
func _on_RestartButton_pressed():
get_tree().paused = false
get_tree().reload_current_scene()
func _on_QuitButton_pressed():
get_tree().quit()

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Scene/Pause.gd" type="Script" id=1]
[ext_resource path="res://Scene/EndGameWindow.gd" type="Script" id=1]
[ext_resource path="res://Font/COMIC.tres" type="DynamicFont" id=2]
[node name="CanvasLayer" type="CanvasLayer"]
@ -66,7 +66,7 @@ margin_top = 130.0
margin_right = 70.5
margin_bottom = 182.0
custom_fonts/font = ExtResource( 2 )
text = "Player1"
text = "AZER"
align = 1
valign = 1
autowrap = true

View File

@ -6,7 +6,7 @@
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 15.5015, 46.849 )
[sub_resource type="Animation" id=6]
[sub_resource type="Animation" id=2]
resource_name = "IdleDown"
length = 0.1
loop = true
@ -23,7 +23,7 @@ tracks/0/keys = {
"values": [ 7 ]
}
[sub_resource type="Animation" id=7]
[sub_resource type="Animation" id=3]
resource_name = "IdleLeft"
length = 0.1
loop = true
@ -40,7 +40,7 @@ tracks/0/keys = {
"values": [ 14 ]
}
[sub_resource type="Animation" id=8]
[sub_resource type="Animation" id=4]
resource_name = "IdleRight"
length = 0.1
loop = true
@ -57,7 +57,7 @@ tracks/0/keys = {
"values": [ 0 ]
}
[sub_resource type="Animation" id=9]
[sub_resource type="Animation" id=5]
resource_name = "IdleTop"
length = 0.1
loop = true
@ -74,8 +74,7 @@ tracks/0/keys = {
"values": [ 21 ]
}
[sub_resource type="Animation" id=2]
resource_name = "RunDown"
[sub_resource type="Animation" id=6]
length = 0.7
loop = true
tracks/0/type = "value"
@ -91,8 +90,7 @@ tracks/0/keys = {
"values": [ 8, 9, 10, 11, 12, 13, 7 ]
}
[sub_resource type="Animation" id=3]
resource_name = "RunLeft"
[sub_resource type="Animation" id=7]
length = 0.7
loop = true
tracks/0/type = "value"
@ -108,8 +106,7 @@ tracks/0/keys = {
"values": [ 15, 16, 17, 18, 19, 20, 14 ]
}
[sub_resource type="Animation" id=4]
resource_name = "RunRight"
[sub_resource type="Animation" id=8]
length = 0.7
loop = true
tracks/0/type = "value"
@ -125,8 +122,7 @@ tracks/0/keys = {
"values": [ 1, 2, 3, 4, 5, 6, 0 ]
}
[sub_resource type="Animation" id=5]
resource_name = "RunUp"
[sub_resource type="Animation" id=9]
length = 0.7
loop = true
tracks/0/type = "value"
@ -219,14 +215,14 @@ position = Vector2( 0.263519, 0.0374289 )
shape = SubResource( 1 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/IdleDown = SubResource( 6 )
anims/IdleLeft = SubResource( 7 )
anims/IdleRight = SubResource( 8 )
anims/IdleTop = SubResource( 9 )
anims/RunDown = SubResource( 2 )
anims/RunLeft = SubResource( 3 )
anims/RunRight = SubResource( 4 )
anims/RunUp = SubResource( 5 )
anims/IdleDown = SubResource( 2 )
anims/IdleLeft = SubResource( 3 )
anims/IdleRight = SubResource( 4 )
anims/IdleTop = SubResource( 5 )
anims/RunDown = SubResource( 6 )
anims/RunLeft = SubResource( 7 )
anims/RunRight = SubResource( 8 )
anims/RunUp = SubResource( 9 )
[node name="AnimationTree" type="AnimationTree" parent="."]
tree_root = SubResource( 22 )

View File

@ -1,15 +1,19 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Scene/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Assets/Placeholder.png" type="Texture" id=2]
[ext_resource path="res://Scene/Clopinette.tscn" type="PackedScene" id=3]
[ext_resource path="res://Scene/EndGameWindow.tscn" type="PackedScene" id=4]
[ext_resource path="res://Scene/GameManager.tscn" type="PackedScene" id=5]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 15.6178, 15.7669 )
[node name="World" type="Node2D"]
[node name="Player1" parent="." instance=ExtResource( 1 )]
[node name="Player1" parent="." groups=[
"player",
] instance=ExtResource( 1 )]
position = Vector2( 119.977, 88.9695 )
[node name="obstacle" type="StaticBody2D" parent="."]
@ -24,7 +28,9 @@ texture = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="obstacle"]
shape = SubResource( 1 )
[node name="Player2" parent="." instance=ExtResource( 1 )]
[node name="Player2" parent="." groups=[
"player",
] instance=ExtResource( 1 )]
position = Vector2( 221.278, 126.45 )
[node name="Clopinette" parent="." instance=ExtResource( 3 )]
@ -35,7 +41,9 @@ scriptName = "res://Scripts/PaintEffects/Invisibility.gd"
position = Vector2( 305.804, 276.773 )
scriptName = "res://Scripts/PaintEffects/Upscale.gd"
[node name="Clopinette3" parent="." instance=ExtResource( 3 )]
[node name="Clopinette3" parent="." groups=[
"bucket",
] instance=ExtResource( 3 )]
position = Vector2( 459.898, 280.888 )
scriptName = "res://Scripts/PaintEffects/Downscale.gd"
@ -109,3 +117,27 @@ text = "Patinoire"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CanvasLayer" parent="." instance=ExtResource( 4 )]
[node name="GameManager" parent="." instance=ExtResource( 5 )]
[node name="SpawnPoint" type="Node2D" parent="." groups=[
"spawn_point",
]]
position = Vector2( 884.401, 163.634 )
[node name="SpawnPoint2" type="Node2D" parent="." groups=[
"spawn_point",
]]
position = Vector2( 812.324, 467.525 )
[node name="SpawnPoint3" type="Node2D" parent="." groups=[
"spawn_point",
]]
position = Vector2( 1203.88, 315.579 )
[node name="SpawnPoint4" type="Node2D" parent="." groups=[
"spawn_point",
]]
position = Vector2( 477.265, 794.792 )

View File

@ -16,7 +16,15 @@ func spawnBucket():
func _process(delta):
if get_tree().get_nodes_in_group("bucket").empty():
spawnBucket()
endGame()
#endGame()
func endGame():
get_node("/root/World/CanvasLayer/Window").show()
get_node("/root/World/CanvasLayer/Window").showEndGameWindow(getWinner())
func getWinner():
var players = get_tree().get_nodes_in_group("player")
for player in players:
if player.curLife > 0:
return player.name
return "Player1"

View File

@ -67,7 +67,6 @@ func updatePaintEffects(delta):
for rout in updated:
coroutines.append(rout)
func addCoroutine(routine):
coroutines.append(routine)