gover man!
This commit is contained in:
parent
55059788b2
commit
81b01b7508
8 changed files with 185 additions and 36 deletions
|
|
@ -6,19 +6,30 @@ extends Node
|
||||||
@export var lives = 2
|
@export var lives = 2
|
||||||
@export var bombs = 3
|
@export var bombs = 3
|
||||||
|
|
||||||
|
#func _process(delta: float) -> void:
|
||||||
|
#print(Display.current_scene)
|
||||||
|
|
||||||
func change_score(amount):
|
func change_score(amount):
|
||||||
score += amount
|
score += amount
|
||||||
Hud.score_label = str("SCORE: ") + str(score)
|
Hud.score_label.text = str("SCORE: ") + str(score)
|
||||||
|
|
||||||
func change_graze(amount):
|
func change_graze(amount):
|
||||||
graze += amount
|
graze += amount
|
||||||
level_graze += amount
|
level_graze += amount
|
||||||
Hud.graze_label = str("GRAZE: ") + str(level_graze)
|
Hud.graze_label.text = str("GRAZE: ") + str(level_graze)
|
||||||
|
|
||||||
func change_lives(amount):
|
func change_lives(amount):
|
||||||
lives += amount
|
lives += amount
|
||||||
Hud.lives_label = str("LIVES: ") + str(lives)
|
lives = clamp(lives,-1,9)
|
||||||
|
Hud.lives_label.text = str("LIVES: ") + str(lives)
|
||||||
|
if lives < 0:
|
||||||
|
Hud.lives_label.text = str("LIVES: ") + str(0)
|
||||||
|
var Gover = load("res://menus/game_over.tscn")
|
||||||
|
var gover = Gover.instantiate()
|
||||||
|
#TODO implement properly
|
||||||
|
get_tree().paused = true
|
||||||
|
Display.viewport.add_child(gover)
|
||||||
|
|
||||||
func change_bombs(amount):
|
func change_bombs(amount):
|
||||||
bombs += amount
|
bombs += amount
|
||||||
Hud.bombs_label = str("BOMB: ") + str(bombs)
|
Hud.bombs_label.text = str("BOMB: ") + str(bombs)
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,5 @@
|
||||||
[ext_resource type="Script" uid="uid://4lh6pskiiq1c" path="res://globals/currentgame.gd" id="1_0tn8j"]
|
[ext_resource type="Script" uid="uid://4lh6pskiiq1c" path="res://globals/currentgame.gd" id="1_0tn8j"]
|
||||||
|
|
||||||
[node name="CurrentGame" type="Node"]
|
[node name="CurrentGame" type="Node"]
|
||||||
|
process_mode = 3
|
||||||
script = ExtResource("1_0tn8j")
|
script = ExtResource("1_0tn8j")
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
[ext_resource type="Script" uid="uid://p8hkie00rjtx" path="res://gui/hud.gd" id="1_u7rvv"]
|
[ext_resource type="Script" uid="uid://p8hkie00rjtx" path="res://gui/hud.gd" id="1_u7rvv"]
|
||||||
|
|
||||||
[node name="Hud" type="CanvasLayer" groups=["viewport_autoload"]]
|
[node name="Hud" type="CanvasLayer" groups=["viewport_autoload"]]
|
||||||
|
process_mode = 3
|
||||||
script = ExtResource("1_u7rvv")
|
script = ExtResource("1_u7rvv")
|
||||||
|
|
||||||
[node name="Score" type="Label" parent="."]
|
[node name="Score" type="Label" parent="."]
|
||||||
|
|
|
||||||
154
menus/game_over.tscn
Normal file
154
menus/game_over.tscn
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
[gd_scene load_steps=5 format=3 uid="uid://caiqjh3ff6rym"]
|
||||||
|
|
||||||
|
[ext_resource type="FontFile" uid="uid://dseq0eyk0say1" path="res://fonts/Super Mario Bros. NES.ttf" id="1_v8xbx"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_mq8lb"]
|
||||||
|
resource_name = "gover"
|
||||||
|
length = 2.0
|
||||||
|
step = 0.0333333
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("ColorRect:size")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.56666666),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(240, 0), Vector2(240, 320)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("GameOver:scale")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1, 1.5333333),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 0), Vector2(0, 0), Vector2(1, 1)]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("GameOver:rotation")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1, 1.5333333),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0, 0.0, 6.283185307179586]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/imported = false
|
||||||
|
tracks/3/enabled = true
|
||||||
|
tracks/3/path = NodePath("Retry?:scale")
|
||||||
|
tracks/3/interp = 1
|
||||||
|
tracks/3/loop_wrap = true
|
||||||
|
tracks/3/keys = {
|
||||||
|
"times": PackedFloat32Array(1.7333333, 1.9333333),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 0), Vector2(1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_slp2k"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("ColorRect:size")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(240, 320)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("GameOver:scale")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1, 1)]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("GameOver:rotation")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [0.0]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/imported = false
|
||||||
|
tracks/3/enabled = true
|
||||||
|
tracks/3/path = NodePath("Retry?:scale")
|
||||||
|
tracks/3/interp = 1
|
||||||
|
tracks/3/loop_wrap = true
|
||||||
|
tracks/3/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hl86a"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_slp2k"),
|
||||||
|
&"gover": SubResource("Animation_mq8lb")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="GameOver" type="Control" groups=["viewport_autoload"]]
|
||||||
|
process_mode = 3
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 240.0
|
||||||
|
offset_bottom = 320.0
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_hl86a")
|
||||||
|
}
|
||||||
|
autoplay = "gover"
|
||||||
|
|
||||||
|
[node name="GameOver" type="Label" parent="."]
|
||||||
|
modulate = Color(1, 0, 0, 1)
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 50.0
|
||||||
|
offset_top = 139.0
|
||||||
|
offset_right = 194.0
|
||||||
|
offset_bottom = 157.0
|
||||||
|
theme_override_fonts/font = ExtResource("1_v8xbx")
|
||||||
|
theme_override_font_sizes/font_size = 16
|
||||||
|
text = "GAME OVER"
|
||||||
|
|
||||||
|
[node name="Retry?" type="Label" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 98.0
|
||||||
|
offset_top = 167.0
|
||||||
|
offset_right = 146.0
|
||||||
|
offset_bottom = 190.0
|
||||||
|
rotation = 6.2831855
|
||||||
|
theme_override_fonts/font = ExtResource("1_v8xbx")
|
||||||
|
theme_override_font_sizes/font_size = 8
|
||||||
|
text = "Retry?"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
@ -7,23 +7,24 @@ extends CharacterBody2D
|
||||||
@export var move_focused_speed: float
|
@export var move_focused_speed: float
|
||||||
@onready var startpos = position
|
@onready var startpos = position
|
||||||
|
|
||||||
|
var can_die = true
|
||||||
|
|
||||||
var focused: bool:
|
var focused: bool:
|
||||||
get(): return Input.is_action_pressed(&"focus")
|
get(): return Input.is_action_pressed(&"focus")
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
var input_dir = Input.get_vector(&"move_left", &"move_right", &"move_up", &"move_down").sign()
|
var input_dir = Input.get_vector(&"move_left", &"move_right", &"move_up", &"move_down").sign()
|
||||||
|
|
||||||
velocity = input_dir.normalized() * (move_focused_speed if focused else move_normal_speed)
|
velocity = input_dir.normalized() * (move_focused_speed if focused else move_normal_speed)
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
||||||
|
|
||||||
func _on_hurtbox_area_entered(area: Area2D) -> void:
|
func _on_hurtbox_area_entered(area: Area2D) -> void:
|
||||||
|
if can_die:
|
||||||
%DeathSound.play()
|
%DeathSound.play()
|
||||||
position = startpos
|
position = startpos
|
||||||
CurrentGame.change_lives(-1)
|
CurrentGame.change_lives(-1)
|
||||||
if CurrentGame.lives < 0:
|
can_die = false
|
||||||
gover()
|
|
||||||
|
|
||||||
func gover():
|
func gover():
|
||||||
print("yeeeowtch!!!")
|
print("yeeeowtch!!!")
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=13 format=3 uid="uid://c714s5d7d5765"]
|
[gd_scene load_steps=12 format=3 uid="uid://c714s5d7d5765"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bpo15kuxdmulu" path="res://objects/player/player.gd" id="1_cqmt1"]
|
[ext_resource type="Script" uid="uid://bpo15kuxdmulu" path="res://objects/player/player.gd" id="1_cqmt1"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cre6i8tsdlt7j" path="res://graphics/player/player_1.png" id="2_jnjyq"]
|
[ext_resource type="Texture2D" uid="uid://cre6i8tsdlt7j" path="res://graphics/player/player_1.png" id="2_jnjyq"]
|
||||||
|
|
@ -33,11 +33,7 @@ size = Vector2(22, 22)
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_gnkmh"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_gnkmh"]
|
||||||
radius = 13.038404
|
radius = 13.038404
|
||||||
|
|
||||||
[sub_resource type="Gradient" id="Gradient_aeam7"]
|
[node name="Player" type="CharacterBody2D" groups=["player"]]
|
||||||
offsets = PackedFloat32Array(0, 0.513333, 1)
|
|
||||||
colors = PackedColorArray(0, 0.647059, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1)
|
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody2D"]
|
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
script = ExtResource("1_cqmt1")
|
script = ExtResource("1_cqmt1")
|
||||||
move_normal_speed = 200.0
|
move_normal_speed = 200.0
|
||||||
|
|
@ -84,21 +80,10 @@ debug_color = Color(0.7740294, 0.14773864, 0.99999994, 0.41960785)
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
stream = ExtResource("5_gnkmh")
|
stream = ExtResource("5_gnkmh")
|
||||||
|
|
||||||
[node name="GrazeParticles" type="CPUParticles2D" parent="." instance=ExtResource("6_xkryw")]
|
[node name="GrazeParticles" parent="." instance=ExtResource("6_xkryw")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
emitting = false
|
|
||||||
amount = 10
|
amount = 10
|
||||||
lifetime = 0.15
|
script = null
|
||||||
one_shot = true
|
|
||||||
speed_scale = 0.5
|
|
||||||
explosiveness = 0.6
|
|
||||||
randomness = 1.0
|
|
||||||
lifetime_randomness = 1.0
|
|
||||||
spread = 154.09
|
|
||||||
gravity = Vector2(0, 630)
|
|
||||||
initial_velocity_min = 251.99
|
|
||||||
initial_velocity_max = 484.86
|
|
||||||
color_ramp = SubResource("Gradient_aeam7")
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="Hurtbox" to="." method="_on_hurtbox_area_entered"]
|
[connection signal="area_entered" from="Hurtbox" to="." method="_on_hurtbox_area_entered"]
|
||||||
[connection signal="area_entered" from="GrazeBox" to="." method="_on_graze_box_area_entered"]
|
[connection signal="area_entered" from="GrazeBox" to="." method="_on_graze_box_area_entered"]
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ Hud="*res://gui/hud.tscn"
|
||||||
|
|
||||||
window/size/viewport_width=240
|
window/size/viewport_width=240
|
||||||
window/size/viewport_height=320
|
window/size/viewport_height=320
|
||||||
|
window/vsync/vsync_mode=0
|
||||||
|
|
||||||
[editor_plugins]
|
[editor_plugins]
|
||||||
|
|
||||||
|
|
@ -46,6 +47,7 @@ folder_colors={
|
||||||
[global_group]
|
[global_group]
|
||||||
|
|
||||||
viewport_autoload=""
|
viewport_autoload=""
|
||||||
|
player=""
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ position = Vector2(124, 280)
|
||||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||||
|
|
||||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="StaticBody2D"]
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="StaticBody2D"]
|
||||||
position = Vector2(246, 160)
|
position = Vector2(245, 160)
|
||||||
shape = SubResource("RectangleShape2D_ikr60")
|
shape = SubResource("RectangleShape2D_ikr60")
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||||
|
|
@ -53,9 +53,3 @@ position = Vector2(124, 81)
|
||||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
stream = ExtResource("5_wcm38")
|
stream = ExtResource("5_wcm38")
|
||||||
autoplay = true
|
autoplay = true
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
|
||||||
offset_right = 40.0
|
|
||||||
offset_bottom = 23.0
|
|
||||||
text = "SCORE: 000000000
|
|
||||||
GRAZE: 0"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue