hud
This commit is contained in:
parent
a6421235f8
commit
d729c0a7a3
14 changed files with 187 additions and 2 deletions
BIN
fonts/Super Mario Bros. NES.ttf
Normal file
BIN
fonts/Super Mario Bros. NES.ttf
Normal file
Binary file not shown.
36
fonts/Super Mario Bros. NES.ttf.import
Normal file
36
fonts/Super Mario Bros. NES.ttf.import
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dseq0eyk0say1"
|
||||
path="res://.godot/imported/Super Mario Bros. NES.ttf-ea2dfdfff0c2f0101086d00b32189147.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://fonts/Super Mario Bros. NES.ttf"
|
||||
dest_files=["res://.godot/imported/Super Mario Bros. NES.ttf-ea2dfdfff0c2f0101086d00b32189147.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
modulate_color_glyphs=false
|
||||
hinting=1
|
||||
subpixel_positioning=4
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
||||
24
globals/currentgame.gd
Normal file
24
globals/currentgame.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extends Node
|
||||
|
||||
@export var score = 0
|
||||
@export var graze = 0
|
||||
@export var level_graze = 0
|
||||
@export var lives = 2
|
||||
@export var bombs = 3
|
||||
|
||||
func change_score(amount):
|
||||
score += amount
|
||||
Hud.score_label = str("SCORE: ") + str(score)
|
||||
|
||||
func change_graze(amount):
|
||||
graze += amount
|
||||
level_graze += amount
|
||||
Hud.graze_label = str("GRAZE: ") + str(level_graze)
|
||||
|
||||
func change_lives(amount):
|
||||
lives += amount
|
||||
Hud.lives_label = str("GRAZE: ") + str(lives)
|
||||
|
||||
func change_bombs(amount):
|
||||
bombs += amount
|
||||
Hud.bombs_label = str("GRAZE: ") + str(bombs)
|
||||
1
globals/currentgame.gd.uid
Normal file
1
globals/currentgame.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://4lh6pskiiq1c
|
||||
6
globals/currentgame.tscn
Normal file
6
globals/currentgame.tscn
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://yibsx87q42c1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://4lh6pskiiq1c" path="res://globals/currentgame.gd" id="1_0tn8j"]
|
||||
|
||||
[node name="CurrentGame" type="Node"]
|
||||
script = ExtResource("1_0tn8j")
|
||||
6
gui/hud.gd
Normal file
6
gui/hud.gd
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
extends CanvasLayer
|
||||
|
||||
@onready var score_label = $Score
|
||||
@onready var graze_label = $Graze
|
||||
@onready var lives_label = $Lives
|
||||
@onready var bombs_label = $Bombs
|
||||
1
gui/hud.gd.uid
Normal file
1
gui/hud.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://p8hkie00rjtx
|
||||
44
gui/hud.tscn
Normal file
44
gui/hud.tscn
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://6vjf1falt0a7"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dseq0eyk0say1" path="res://fonts/Super Mario Bros. NES.ttf" id="1_350da"]
|
||||
[ext_resource type="Script" uid="uid://p8hkie00rjtx" path="res://gui/hud.gd" id="1_u7rvv"]
|
||||
|
||||
[node name="Hud" type="CanvasLayer" groups=["viewport_autoload"]]
|
||||
script = ExtResource("1_u7rvv")
|
||||
|
||||
[node name="Score" type="Label" parent="."]
|
||||
offset_left = 4.0
|
||||
offset_top = 4.0
|
||||
offset_right = 132.0
|
||||
offset_bottom = 13.0
|
||||
theme_override_fonts/font = ExtResource("1_350da")
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "Score:0000000000"
|
||||
|
||||
[node name="Graze" type="Label" parent="."]
|
||||
offset_left = 4.0
|
||||
offset_top = 15.0
|
||||
offset_right = 132.0
|
||||
offset_bottom = 26.0
|
||||
theme_override_fonts/font = ExtResource("1_350da")
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "Graze:0"
|
||||
|
||||
[node name="Lives" type="Label" parent="."]
|
||||
offset_left = 4.0
|
||||
offset_top = 309.0
|
||||
offset_right = 132.0
|
||||
offset_bottom = 320.0
|
||||
theme_override_fonts/font = ExtResource("1_350da")
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "Lives:2"
|
||||
|
||||
[node name="Bombs" type="Label" parent="."]
|
||||
offset_left = 108.0
|
||||
offset_top = 309.0
|
||||
offset_right = 236.0
|
||||
offset_bottom = 320.0
|
||||
theme_override_fonts/font = ExtResource("1_350da")
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "Bombs:3"
|
||||
horizontal_alignment = 2
|
||||
|
|
@ -3,6 +3,7 @@ extends Node2D
|
|||
var health = 100.0
|
||||
|
||||
func _on_area_2d_area_entered(area: Area2D) -> void:
|
||||
CurrentGame.change_score(100)
|
||||
%HurtSound.play()
|
||||
health -= 0.25
|
||||
print(%Movements.current_animation)
|
||||
|
|
|
|||
32
objects/graze/graze_particles.tscn
Normal file
32
objects/graze/graze_particles.tscn
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://ykg8dydq006a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bdcxqp8royr5u" path="res://objects/scoreitem/scoreitem_particles.gd" id="1_s0vci"]
|
||||
[ext_resource type="AudioStream" uid="uid://bv6v7v5dtvoii" path="res://audio/sfx/graze.wav" id="2_55vho"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_aeam7"]
|
||||
offsets = PackedFloat32Array(0, 0.513333, 1)
|
||||
colors = PackedColorArray(0, 0.647059, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1)
|
||||
|
||||
[node name="CPUParticles2D" type="CPUParticles2D"]
|
||||
emitting = false
|
||||
amount = 24
|
||||
lifetime = 0.15
|
||||
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
|
||||
scale_amount_min = 1.5
|
||||
scale_amount_max = 2.5
|
||||
color_ramp = SubResource("Gradient_aeam7")
|
||||
script = ExtResource("1_s0vci")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_55vho")
|
||||
autoplay = true
|
||||
|
||||
[connection signal="finished" from="." to="." method="_on_finished"]
|
||||
|
|
@ -21,3 +21,14 @@ func _physics_process(delta: float) -> void:
|
|||
func _on_hurtbox_area_entered(area: Area2D) -> void:
|
||||
%DeathSound.play()
|
||||
position = startpos
|
||||
CurrentGame.change_lives(-1)
|
||||
if CurrentGame.lives < 0:
|
||||
gover()
|
||||
|
||||
func gover():
|
||||
print("yeeeowtch!!!")
|
||||
|
||||
func _on_graze_box_area_entered(area: Area2D) -> void:
|
||||
%GrazeParticles.emitting = true
|
||||
CurrentGame.change_graze(1)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=11 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="Texture2D" uid="uid://cre6i8tsdlt7j" path="res://graphics/player/player_1.png" id="2_jnjyq"]
|
||||
[ext_resource type="Texture2D" uid="uid://cr8jegbgl0wxn" path="res://graphics/player/player_3.png" id="3_gnkmh"]
|
||||
[ext_resource type="PackedScene" uid="uid://bs0tv5ubqdjp0" path="res://objects/player/bullet_emitter/player_bullet_emitter.tscn" id="3_ssrue"]
|
||||
[ext_resource type="AudioStream" uid="uid://b3byh6su1b11r" path="res://audio/sounds/se_boom.wav" id="5_gnkmh"]
|
||||
[ext_resource type="PackedScene" uid="uid://ykg8dydq006a" path="res://objects/graze/graze_particles.tscn" id="6_xkryw"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_xkryw"]
|
||||
animations = [{
|
||||
|
|
@ -30,7 +31,7 @@ size = Vector2(4, 4)
|
|||
size = Vector2(22, 22)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_gnkmh"]
|
||||
radius = 5.0990195
|
||||
radius = 13.038404
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
collision_layer = 2
|
||||
|
|
@ -69,6 +70,7 @@ shape = SubResource("RectangleShape2D_jnjyq")
|
|||
|
||||
[node name="GrazeBox" type="Area2D" parent="."]
|
||||
position = Vector2(0, -1)
|
||||
collision_mask = 8
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="GrazeBox"]
|
||||
shape = SubResource("CircleShape2D_gnkmh")
|
||||
|
|
@ -78,4 +80,13 @@ debug_color = Color(0.7740294, 0.14773864, 0.99999994, 0.41960785)
|
|||
unique_name_in_owner = true
|
||||
stream = ExtResource("5_gnkmh")
|
||||
|
||||
[node name="GrazeParticles" parent="." instance=ExtResource("6_xkryw")]
|
||||
unique_name_in_owner = true
|
||||
amount = 10
|
||||
scale_amount_min = 1.0
|
||||
scale_amount_max = 1.0
|
||||
script = null
|
||||
|
||||
[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="finished" from="GrazeParticles" to="." method="_on_cpu_particles_2d_finished"]
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ Background="*res://globals/background.tscn"
|
|||
Display="*res://globals/display.tscn"
|
||||
SceneStack="*res://globals/scene_stack.gd"
|
||||
DebugOverlay="*res://globals/debug_overlay.tscn"
|
||||
CurrentGame="*res://globals/currentgame.tscn"
|
||||
Hud="*res://gui/hud.tscn"
|
||||
|
||||
[display]
|
||||
|
||||
|
|
@ -42,6 +44,10 @@ folder_colors={
|
|||
"res://systems/": "red"
|
||||
}
|
||||
|
||||
[global_group]
|
||||
|
||||
viewport_autoload=""
|
||||
|
||||
[input]
|
||||
|
||||
move_left={
|
||||
|
|
|
|||
|
|
@ -53,3 +53,9 @@ position = Vector2(124, 81)
|
|||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("5_wcm38")
|
||||
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