mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-28 15:08:20 -05:00
Made initial GameOver & star background
This commit is contained in:
parent
6c32b12a3c
commit
bf76938876
BIN
assets/_RAW_/star.pxo
Normal file
BIN
assets/_RAW_/star.pxo
Normal file
Binary file not shown.
BIN
assets/img/star.png
Normal file
BIN
assets/img/star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
34
assets/img/star.png.import
Normal file
34
assets/img/star.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://chuygpyfe3y10"
|
||||||
|
path="res://.godot/imported/star.png-309e5a4c97bcbe7eab4eb743f683232b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/img/star.png"
|
||||||
|
dest_files=["res://.godot/imported/star.png-309e5a4c97bcbe7eab4eb743f683232b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
@ -1,8 +1,18 @@
|
|||||||
[gd_scene load_steps=4 format=3 uid="uid://bdarunpk3c2eh"]
|
[gd_scene load_steps=8 format=3 uid="uid://bdarunpk3c2eh"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/game.gd" id="1_6727i"]
|
[ext_resource type="Script" path="res://scripts/game.gd" id="1_6727i"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cbo47ftx0vcro" path="res://scenes/ship.tscn" id="1_esyqo"]
|
[ext_resource type="PackedScene" uid="uid://cbo47ftx0vcro" path="res://scenes/ship.tscn" id="1_esyqo"]
|
||||||
[ext_resource type="FontFile" uid="uid://bkcxbtx1vcj8w" path="res://assets/fonts/Color Basic.otf" id="2_gwtm0"]
|
[ext_resource type="FontFile" uid="uid://bkcxbtx1vcj8w" path="res://assets/fonts/Color Basic.otf" id="2_gwtm0"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://0yktrbyp6cr3" path="res://scenes/game_over_screen.tscn" id="3_yy075"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://chuygpyfe3y10" path="res://assets/img/star.png" id="4_jc3cg"]
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_8qyxb"]
|
||||||
|
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.606742, 1), 0.052866, 0.052866, 0, 0, Vector2(1, 0.615385), 0.0, 0.0, 0, 0]
|
||||||
|
point_count = 3
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_rnjki"]
|
||||||
|
offsets = PackedFloat32Array(0, 0.406667, 0.84)
|
||||||
|
colors = PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="Game" type="Node2D"]
|
[node name="Game" type="Node2D"]
|
||||||
script = ExtResource("1_6727i")
|
script = ExtResource("1_6727i")
|
||||||
@ -25,6 +35,9 @@ theme_override_font_sizes/font_size = 32
|
|||||||
text = "LEVEL: 1"
|
text = "LEVEL: 1"
|
||||||
horizontal_alignment = 2
|
horizontal_alignment = 2
|
||||||
|
|
||||||
|
[node name="GameOverScreen" parent="UI" instance=ExtResource("3_yy075")]
|
||||||
|
visible = false
|
||||||
|
|
||||||
[node name="Background" type="CanvasLayer" parent="."]
|
[node name="Background" type="CanvasLayer" parent="."]
|
||||||
layer = -1
|
layer = -1
|
||||||
|
|
||||||
@ -37,6 +50,16 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
color = Color(0, 0, 0, 1)
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="Stars" type="CPUParticles2D" parent="Background"]
|
||||||
|
amount = 64
|
||||||
|
lifetime = 5.0
|
||||||
|
texture = ExtResource("4_jc3cg")
|
||||||
|
emission_shape = 3
|
||||||
|
emission_rect_extents = Vector2(1200, 700)
|
||||||
|
gravity = Vector2(0, 0)
|
||||||
|
scale_amount_curve = SubResource("Curve_8qyxb")
|
||||||
|
color_ramp = SubResource("Gradient_rnjki")
|
||||||
|
|
||||||
[node name="Ship" parent="." instance=ExtResource("1_esyqo")]
|
[node name="Ship" parent="." instance=ExtResource("1_esyqo")]
|
||||||
z_index = 1
|
z_index = 1
|
||||||
position = Vector2(622, 309)
|
position = Vector2(622, 309)
|
||||||
|
87
scenes/game_over_screen.tscn
Normal file
87
scenes/game_over_screen.tscn
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://0yktrbyp6cr3"]
|
||||||
|
|
||||||
|
[ext_resource type="FontFile" uid="uid://bkcxbtx1vcj8w" path="res://assets/fonts/Color Basic.otf" id="1_lbk85"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/game_over_screen.gd" id="1_o2tyf"]
|
||||||
|
|
||||||
|
[node name="GameOverScreen" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_o2tyf")
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0, 0, 0, 0.596078)
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -184.0
|
||||||
|
offset_top = -132.0
|
||||||
|
offset_right = 192.0
|
||||||
|
offset_bottom = 124.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="GameOverLabel" type="Label" parent="Panel"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 5
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
offset_left = -55.0
|
||||||
|
offset_top = 40.0
|
||||||
|
offset_right = 55.0
|
||||||
|
offset_bottom = 63.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
theme_override_fonts/font = ExtResource("1_lbk85")
|
||||||
|
theme_override_font_sizes/font_size = 36
|
||||||
|
text = "game over"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="RetryButton" type="Button" parent="Panel"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 7
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -100.0
|
||||||
|
offset_top = -96.0
|
||||||
|
offset_right = -30.0
|
||||||
|
offset_bottom = -65.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
theme_override_fonts/font = ExtResource("1_lbk85")
|
||||||
|
text = "retry"
|
||||||
|
|
||||||
|
[node name="QuitButton" type="Button" parent="Panel"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 7
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 28.0
|
||||||
|
offset_top = -96.0
|
||||||
|
offset_right = 98.0
|
||||||
|
offset_bottom = -65.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
theme_override_fonts/font = ExtResource("1_lbk85")
|
||||||
|
text = "quit
|
||||||
|
"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="Panel/RetryButton" to="." method="_on_retry_button_pressed"]
|
||||||
|
[connection signal="pressed" from="Panel/QuitButton" to="." method="_on_quit_button_pressed"]
|
@ -4,6 +4,7 @@ signal comet_shot (size : int)
|
|||||||
signal screen_cleared
|
signal screen_cleared
|
||||||
|
|
||||||
const COMET = preload("res://scenes/comet.tscn")
|
const COMET = preload("res://scenes/comet.tscn")
|
||||||
|
|
||||||
var comet_count := 1
|
var comet_count := 1
|
||||||
|
|
||||||
var viewport_size := Vector2.ZERO
|
var viewport_size := Vector2.ZERO
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
# TODO: Display a game over screen when the ship is hit by a comet with abilty to restart
|
|
||||||
# TODO: Make a space like background, maybe some scrolling, maybe randomly generated
|
|
||||||
# TODO: Make a small title screen that starts before the game scene
|
# TODO: Make a small title screen that starts before the game scene
|
||||||
# TODO: MAYBE track high score in a file & show it on HUD
|
# TODO: MAYBE track high score in a file & show it on HUD
|
||||||
|
|
||||||
@ -9,11 +7,14 @@ const COMET_SPAWNER = preload("res://scenes/comet_spawner.tscn")
|
|||||||
|
|
||||||
@export var level : int = 1
|
@export var level : int = 1
|
||||||
|
|
||||||
|
var viewport_size : Vector2
|
||||||
var score : int = 0
|
var score : int = 0
|
||||||
var points_per_comet := 300
|
var points_per_comet := 300
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
new_level(level)
|
new_level(level)
|
||||||
|
viewport_size = get_viewport_rect().size
|
||||||
|
$Background/Stars.emission_rect_extents = viewport_size
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
update_ui()
|
update_ui()
|
||||||
@ -30,7 +31,10 @@ func level_finished() -> void:
|
|||||||
new_level(level)
|
new_level(level)
|
||||||
|
|
||||||
func game_over() -> void:
|
func game_over() -> void:
|
||||||
pass
|
# Wait 1 second before showing the game over screen for "dramatic" effect
|
||||||
|
await get_tree().create_timer(1.0).timeout
|
||||||
|
$UI/GameOverScreen.visible = true
|
||||||
|
# TODO: Set focus on one of the buttons once the game over screen when shown
|
||||||
|
|
||||||
func increase_score(comet_size : int) -> void:
|
func increase_score(comet_size : int) -> void:
|
||||||
# We add one since comet_size starts count at 0
|
# We add one since comet_size starts count at 0
|
||||||
|
11
scripts/game_over_screen.gd
Normal file
11
scripts/game_over_screen.gd
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
func _on_retry_button_pressed() -> void:
|
||||||
|
# TODO: Reload main game scene from level 1
|
||||||
|
get_tree().change_scene_to_file("res://scenes/game.tscn")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_quit_button_pressed() -> void:
|
||||||
|
# TODO: Go to title screen instead of killing the game
|
||||||
|
get_tree().quit()
|
Loading…
Reference in New Issue
Block a user