This commit is contained in:
Hurlu 2020-04-04 22:18:11 +02:00
commit 632f6f18ac
14 changed files with 205 additions and 13 deletions

BIN
Font/COMIC.TTF Normal file

Binary file not shown.

7
Font/COMIC.tres Normal file
View File

@ -0,0 +1,7 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://Font/COMIC.TTF" type="DynamicFontData" id=1]
[resource]
size = 37
font_data = ExtResource( 1 )

BIN
Font/COMICBD.TTF Normal file

Binary file not shown.

BIN
Font/COMICI.TTF Normal file

Binary file not shown.

BIN
Font/COMICZ.TTF Normal file

Binary file not shown.

14
Scene/EndGameWindow.gd Normal file
View File

@ -0,0 +1,14 @@
extends Control
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()

102
Scene/EndGameWindow.tscn Normal file
View File

@ -0,0 +1,102 @@
[gd_scene load_steps=3 format=2]
[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"]
layer = 100
[node name="Window" type="Control" parent="."]
pause_mode = 2
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Background" type="ColorRect" parent="Window"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 1.22778
margin_top = -1.22775
margin_right = 1.22778
margin_bottom = -1.22778
color = Color( 0, 0, 0, 0.309804 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ColorRect" type="ColorRect" parent="Window"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -267.0
margin_top = -254.0
margin_right = 256.0
margin_bottom = 82.0
color = Color( 0, 0, 0, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Title" type="Label" parent="Window/ColorRect"]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -60.5
margin_top = 28.0
margin_right = 83.5
margin_bottom = 80.0
custom_fonts/font = ExtResource( 2 )
text = "Winner:"
align = 1
valign = 1
autowrap = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="WinnerName" type="Label" parent="Window/ColorRect"]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -53.5
margin_top = 130.0
margin_right = 70.5
margin_bottom = 182.0
custom_fonts/font = ExtResource( 2 )
text = "AZER"
align = 1
valign = 1
autowrap = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="HBoxContainer" parent="Window/ColorRect"]
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -81.0
margin_bottom = -6.0
custom_constants/separation = 25
[node name="RestartButton" type="Button" parent="Window/ColorRect/VBoxContainer"]
margin_right = 249.0
margin_bottom = 75.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = ExtResource( 2 )
text = "Restart"
[node name="QuitButton" type="Button" parent="Window/ColorRect/VBoxContainer"]
margin_left = 274.0
margin_right = 523.0
margin_bottom = 75.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = ExtResource( 2 )
text = "Quit"
[connection signal="pressed" from="Window/ColorRect/VBoxContainer/RestartButton" to="Window" method="_on_RestartButton_pressed"]
[connection signal="pressed" from="Window/ColorRect/VBoxContainer/QuitButton" to="Window" method="_on_QuitButton_pressed"]

6
Scene/GameManager.tscn Normal file
View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Scripts/GameManager.gd" type="Script" id=1]
[node name="GameManager" type="Node2D"]
script = ExtResource( 1 )

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://Scene/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Assets/Placeholder.png" type="Texture" id=2] [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/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] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 15.6178, 15.7669 ) extents = Vector2( 15.6178, 15.7669 )
[node name="World" type="Node2D"] [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 ) position = Vector2( 119.977, 88.9695 )
[node name="obstacle" type="StaticBody2D" parent="."] [node name="obstacle" type="StaticBody2D" parent="."]
@ -24,7 +28,9 @@ texture = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="obstacle"] [node name="CollisionShape2D" type="CollisionShape2D" parent="obstacle"]
shape = SubResource( 1 ) 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 ) position = Vector2( 221.278, 126.45 )
[node name="Clopinette" parent="." instance=ExtResource( 3 )] [node name="Clopinette" parent="." instance=ExtResource( 3 )]
@ -35,7 +41,9 @@ scriptName = "res://Scripts/PaintEffects/Invisibility.gd"
position = Vector2( 305.804, 276.773 ) position = Vector2( 305.804, 276.773 )
scriptName = "res://Scripts/PaintEffects/Upscale.gd" 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 ) position = Vector2( 459.898, 280.888 )
scriptName = "res://Scripts/PaintEffects/Downscale.gd" scriptName = "res://Scripts/PaintEffects/Downscale.gd"
@ -109,3 +117,27 @@ text = "Patinoire"
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_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

@ -1,15 +1,19 @@
extends Node2D extends Node2D
onready var startGameButton = $Sprite/MarginContainer/StartGameButton onready var startGameButton = $Sprite/MarginContainer/HBoxContainer/StartGameButton
onready var quitGameButton = $Sprite/MarginContainer/HBoxContainer/QuitGameButton
func _ready(): func _ready():
startGameButton.grab_focus() startGameButton.grab_focus()
func _process(delta): func _process(delta):
if startGameButton.is_hovered(): if startGameButton.is_hovered():
startGameButton.grab_focus() startGameButton.grab_focus()
elif quitGameButton.is_hovered():
quitGameButton.grab_focus()
func _on_StartGameButton_pressed(): func _on_StartGameButton_pressed():
get_tree().change_scene("res://Scene/TestScene.tscn") get_tree().change_scene("res://Scene/TestScene.tscn")
func _on_QuitGame_pressed():
get_tree().quit()

View File

@ -23,12 +23,26 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="StartGameButton" type="TextureButton" parent="Sprite/MarginContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="Sprite/MarginContainer"]
margin_left = 756.0 margin_left = 674.0
margin_top = 771.0 margin_top = 771.0
margin_right = 820.0 margin_right = 902.0
margin_bottom = 835.0 margin_bottom = 835.0
size_flags_horizontal = 4 size_flags_horizontal = 4
size_flags_vertical = 12
custom_constants/separation = 100
[node name="StartGameButton" type="TextureButton" parent="Sprite/MarginContainer/HBoxContainer"]
margin_right = 64.0
margin_bottom = 64.0
size_flags_horizontal = 4
size_flags_vertical = 8 size_flags_vertical = 8
texture_normal = ExtResource( 3 ) texture_normal = ExtResource( 3 )
[connection signal="pressed" from="Sprite/MarginContainer/StartGameButton" to="." method="_on_StartGameButton_pressed"]
[node name="QuitGameButton" type="TextureButton" parent="Sprite/MarginContainer/HBoxContainer"]
margin_left = 164.0
margin_right = 228.0
margin_bottom = 64.0
texture_normal = ExtResource( 3 )
[connection signal="pressed" from="Sprite/MarginContainer/HBoxContainer/StartGameButton" to="." method="_on_StartGameButton_pressed"]
[connection signal="pressed" from="Sprite/MarginContainer/HBoxContainer/QuitGameButton" to="." method="_on_QuitGame_pressed"]

View File

@ -16,6 +16,15 @@ func spawnBucket():
func _process(delta): func _process(delta):
if get_tree().get_nodes_in_group("bucket").empty(): if get_tree().get_nodes_in_group("bucket").empty():
spawnBucket() spawnBucket()
#endGame()
func endGame(): func endGame():
pass 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: for rout in updated:
coroutines.append(rout) coroutines.append(rout)
func addCoroutine(routine): func addCoroutine(routine):
coroutines.append(routine) coroutines.append(routine)

View File

@ -109,6 +109,11 @@ ui_down2={
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":1,"axis_value":1.0,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":1,"axis":1,"axis_value":1.0,"script":null)
] ]
} }
pause={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
]
}
[rendering] [rendering]