hud
This commit is contained in:
26
gameplay/word_sets/evil.txt
Normal file
26
gameplay/word_sets/evil.txt
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
evil
|
||||||
|
ISRAEL
|
||||||
|
PALANTIR
|
||||||
|
DONALD TRUMP
|
||||||
|
DJT
|
||||||
|
ICE
|
||||||
|
DHS
|
||||||
|
NAZIS
|
||||||
|
NETANYAHU
|
||||||
|
ORACLE
|
||||||
|
MAGA
|
||||||
|
MICROSOFT
|
||||||
|
STEPHEN MILLER
|
||||||
|
NICOLAS MADURO
|
||||||
|
JD VANCE
|
||||||
|
CHARLIE KIRK
|
||||||
|
JEFFREY EPSTEIN
|
||||||
|
EPSTEIN
|
||||||
|
THUNDER BAY
|
||||||
|
IDF
|
||||||
|
TPUSA
|
||||||
|
BILL CLINTON
|
||||||
|
LARRY ELLISON
|
||||||
|
SAM ALTMAN
|
||||||
|
PETER THEIL
|
||||||
|
BLACK ROCK
|
||||||
@@ -11,7 +11,7 @@ var word_set_array
|
|||||||
var alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N",
|
var alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N",
|
||||||
"O","P","Q","R","S","T","U","V","W","X","Y","Z"]
|
"O","P","Q","R","S","T","U","V","W","X","Y","Z"]
|
||||||
var comets = []
|
var comets = []
|
||||||
var comet_speed = 250
|
var comet_speed = 150
|
||||||
var active
|
var active
|
||||||
|
|
||||||
# display
|
# display
|
||||||
@@ -20,10 +20,21 @@ var scale_factor_x
|
|||||||
var scale_factor_y
|
var scale_factor_y
|
||||||
|
|
||||||
# numbers
|
# numbers
|
||||||
var delay = 1.5
|
var max_delay = 2
|
||||||
|
var delay = max_delay
|
||||||
var spawn_timer = 0
|
var spawn_timer = 0
|
||||||
var max_character_count = 0
|
var max_character_count = 0
|
||||||
|
|
||||||
|
# stats
|
||||||
|
var health = 100
|
||||||
|
var miss_count = 0.0
|
||||||
|
var total_comets = 0.0
|
||||||
|
|
||||||
|
# ui init
|
||||||
|
var hp_label
|
||||||
|
var acc_label
|
||||||
|
var miss_label
|
||||||
|
|
||||||
# objects
|
# objects
|
||||||
var comet_source = preload("res://scenes/objects/game/comet.tscn")
|
var comet_source = preload("res://scenes/objects/game/comet.tscn")
|
||||||
var fade
|
var fade
|
||||||
@@ -31,13 +42,11 @@ var pause_menu
|
|||||||
|
|
||||||
# Runs on start
|
# Runs on start
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
# ready ui
|
||||||
viewport_size = get_viewport_rect().size
|
viewport_size = get_viewport_rect().size
|
||||||
#scale_factor_x = viewport_size.x/1280
|
hp_label = self.get_node("OnTop").get_node("HUD").get_node("Stack").get_node("Health")
|
||||||
#scale_factor_y = viewport_size.y/720
|
acc_label = self.get_node("OnTop").get_node("HUD").get_node("Stack").get_node("Accuracy")
|
||||||
|
miss_label = self.get_node("OnTop").get_node("HUD").get_node("Stack").get_node("MissCount")
|
||||||
#print($Tux.position)
|
|
||||||
#$Tux.position = Vector2($Tux.position.x * scale_factor_x, $Tux.position.y * scale_factor_y)
|
|
||||||
#print($Tux.position)
|
|
||||||
|
|
||||||
active = true
|
active = true
|
||||||
|
|
||||||
@@ -73,6 +82,12 @@ func _process(delta: float) -> void:
|
|||||||
if active:
|
if active:
|
||||||
spawn_timer += delta
|
spawn_timer += delta
|
||||||
|
|
||||||
|
hp_label.text = "HP: " + str(health)
|
||||||
|
miss_label.text = "X: " + str(miss_count)
|
||||||
|
if total_comets > 0:
|
||||||
|
var accper = (total_comets - miss_count)/(total_comets)*100
|
||||||
|
acc_label.text = "ACC: " + str(snapped(accper, .02)) + "%"
|
||||||
|
|
||||||
if spawn_timer >= delay:
|
if spawn_timer >= delay:
|
||||||
spawn_timer = 0
|
spawn_timer = 0
|
||||||
spawn_word()
|
spawn_word()
|
||||||
@@ -88,6 +103,7 @@ func spawn_word():
|
|||||||
for char in new_word:
|
for char in new_word:
|
||||||
if char != " ":
|
if char != " ":
|
||||||
var new_commet = comet_source.instantiate()
|
var new_commet = comet_source.instantiate()
|
||||||
|
total_comets += 1
|
||||||
new_commet.position = Vector2(offset,-128)
|
new_commet.position = Vector2(offset,-128)
|
||||||
new_commet.get_node("Sprite").get_node("Label").text = char
|
new_commet.get_node("Sprite").get_node("Label").text = char
|
||||||
new_commet.speed = comet_speed
|
new_commet.speed = comet_speed
|
||||||
@@ -95,7 +111,13 @@ func spawn_word():
|
|||||||
comets.append(new_commet)
|
comets.append(new_commet)
|
||||||
offset += dist
|
offset += dist
|
||||||
|
|
||||||
delay = randf_range(0.75,2)
|
delay = randf_range(0.75,max_delay)
|
||||||
|
|
||||||
|
func take_damage():
|
||||||
|
pass
|
||||||
|
|
||||||
|
func game_over():
|
||||||
|
pass
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventKey and event.pressed:
|
if event is InputEventKey and event.pressed:
|
||||||
@@ -104,7 +126,7 @@ func _input(event):
|
|||||||
if len(comets) > 0:
|
if len(comets) > 0:
|
||||||
var comet = comets[0]
|
var comet = comets[0]
|
||||||
if event.as_text() == comet.get_node("Sprite").get_node("Label").text:
|
if event.as_text() == comet.get_node("Sprite").get_node("Label").text:
|
||||||
comet.active = false
|
comet.self_active = false
|
||||||
var laser = Line2D.new()
|
var laser = Line2D.new()
|
||||||
laser.default_color = Color.RED
|
laser.default_color = Color.RED
|
||||||
laser.points = PackedVector2Array([$Tux.position,comet.position])
|
laser.points = PackedVector2Array([$Tux.position,comet.position])
|
||||||
|
|||||||
@@ -1,20 +1,23 @@
|
|||||||
[gd_scene format=3 uid="uid://bef8re5x0kmmd"]
|
[gd_scene format=3 uid="uid://bef8re5x0kmmd"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://c7vntfq6dyb2k" path="res://scenes/game/comet_zap.gd" id="1_eyb20"]
|
[ext_resource type="Script" uid="uid://c7vntfq6dyb2k" path="res://scenes/game/comet_zap.gd" id="1_eyb20"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dshpn3ffg3bch" path="res://original data/images/backgrounds/0.jpg" id="2_2j0xl"]
|
[ext_resource type="Texture2D" uid="uid://b0jndopqfkddu" path="res://assets/visual/backgrounds/omori/Battle Backgrounds/battleback_ow_outskirts.png" id="2_2j0xl"]
|
||||||
[ext_resource type="AudioStream" uid="uid://b2l55uknctgo6" path="res://assets/audio/music/game/comet_zap/Ranma Nibun-no-ichi Bakuretsu Rantouhen - King's Casino [Qk0v_NIqVPg].mp3" id="2_ije4o"]
|
[ext_resource type="AudioStream" uid="uid://b2l55uknctgo6" path="res://assets/audio/music/game/comet_zap/Ranma Nibun-no-ichi Bakuretsu Rantouhen - King's Casino [Qk0v_NIqVPg].mp3" id="2_ije4o"]
|
||||||
[ext_resource type="AudioStream" uid="uid://ckr4pf3etle0p" path="res://assets/audio/sfx/SYS_cancel.ogg" id="4_2j0xl"]
|
[ext_resource type="AudioStream" uid="uid://ckr4pf3etle0p" path="res://assets/audio/sfx/SYS_cancel.ogg" id="4_2j0xl"]
|
||||||
[ext_resource type="Texture2D" uid="uid://jd2rnhvq6gl6" path="res://original data/images/tux/tux-yes2.png" id="4_yib6v"]
|
[ext_resource type="Texture2D" uid="uid://jd2rnhvq6gl6" path="res://original data/images/tux/tux-yes2.png" id="4_yib6v"]
|
||||||
[ext_resource type="AudioStream" uid="uid://t6tbvilcrwy8" path="res://assets/audio/sfx/SE_Push.ogg" id="5_62k7v"]
|
[ext_resource type="AudioStream" uid="uid://t6tbvilcrwy8" path="res://assets/audio/sfx/SE_Push.ogg" id="5_62k7v"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dm6jp4gjboooc" path="res://scenes/menus/pause/pause.tscn" id="6_cjaft"]
|
[ext_resource type="PackedScene" uid="uid://dm6jp4gjboooc" path="res://scenes/menus/pause/pause.tscn" id="6_cjaft"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_2j0xl"]
|
||||||
|
font_size = 50
|
||||||
|
|
||||||
[node name="CometZap" type="Node2D" unique_id=1227404695]
|
[node name="CometZap" type="Node2D" unique_id=1227404695]
|
||||||
script = ExtResource("1_eyb20")
|
script = ExtResource("1_eyb20")
|
||||||
|
|
||||||
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1005683026]
|
[node name="Background" type="CanvasLayer" parent="." unique_id=1005683026]
|
||||||
layer = -1
|
layer = -1
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="CanvasLayer" unique_id=2022519285]
|
[node name="Control" type="Control" parent="Background" unique_id=2022519285]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -23,7 +26,7 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
metadata/_edit_use_anchors_ = true
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/Control" unique_id=308962101]
|
[node name="TextureRect" type="TextureRect" parent="Background/Control" unique_id=308962101]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@@ -52,6 +55,45 @@ texture = ExtResource("4_yib6v")
|
|||||||
|
|
||||||
[node name="OnTop" type="CanvasLayer" parent="." unique_id=828008006]
|
[node name="OnTop" type="CanvasLayer" parent="." unique_id=828008006]
|
||||||
|
|
||||||
|
[node name="HUD" type="Control" parent="OnTop" unique_id=2042422382]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Stack" type="BoxContainer" parent="OnTop/HUD" unique_id=1113890134]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 1
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
offset_left = -366.0
|
||||||
|
offset_bottom = 215.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
vertical = true
|
||||||
|
|
||||||
|
[node name="Health" type="Label" parent="OnTop/HUD/Stack" unique_id=411589405]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 0
|
||||||
|
size_flags_vertical = 6
|
||||||
|
text = "HP:"
|
||||||
|
label_settings = SubResource("LabelSettings_2j0xl")
|
||||||
|
|
||||||
|
[node name="Accuracy" type="Label" parent="OnTop/HUD/Stack" unique_id=1592115024]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 0
|
||||||
|
size_flags_vertical = 6
|
||||||
|
text = "ACC:"
|
||||||
|
label_settings = SubResource("LabelSettings_2j0xl")
|
||||||
|
|
||||||
|
[node name="MissCount" type="Label" parent="OnTop/HUD/Stack" unique_id=1954191478]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 0
|
||||||
|
size_flags_vertical = 6
|
||||||
|
text = "X:"
|
||||||
|
label_settings = SubResource("LabelSettings_2j0xl")
|
||||||
|
|
||||||
[node name="Pause" parent="OnTop" unique_id=1227462733 instance=ExtResource("6_cjaft")]
|
[node name="Pause" parent="OnTop" unique_id=1227462733 instance=ExtResource("6_cjaft")]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ extends Node2D
|
|||||||
var speed = 100
|
var speed = 100
|
||||||
var scene
|
var scene
|
||||||
var active = true
|
var active = true
|
||||||
|
var self_active = true
|
||||||
|
var damage = 1
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
scene = self.get_parent()
|
scene = self.get_parent()
|
||||||
@@ -10,8 +12,11 @@ func _ready() -> void:
|
|||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
active = scene.active
|
active = scene.active
|
||||||
|
|
||||||
if active:
|
if active and self_active:
|
||||||
self.position.y += speed*delta
|
self.position.y += speed*delta
|
||||||
if self.position.y >= get_viewport_rect().size.y:
|
|
||||||
scene.comets.erase(self)
|
if self.position.y >= get_viewport_rect().size.y:
|
||||||
self.queue_free()
|
scene.health -= damage
|
||||||
|
scene.miss_count += 1.0
|
||||||
|
scene.comets.erase(self)
|
||||||
|
self.queue_free()
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ outline_color = Color(0.9529412, 0.16078432, 1, 1)
|
|||||||
script = ExtResource("1_0gpin")
|
script = ExtResource("1_0gpin")
|
||||||
|
|
||||||
[node name="Sprite" type="AnimatedSprite2D" parent="." unique_id=1849187873]
|
[node name="Sprite" type="AnimatedSprite2D" parent="." unique_id=1849187873]
|
||||||
|
self_modulate = Color(1, 1, 1, 0)
|
||||||
position = Vector2(0, -1)
|
position = Vector2(0, -1)
|
||||||
sprite_frames = SubResource("SpriteFrames_ggplc")
|
sprite_frames = SubResource("SpriteFrames_ggplc")
|
||||||
animation = &"cometbreak"
|
animation = &"comet"
|
||||||
autoplay = "comet"
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="Sprite" unique_id=494320078]
|
[node name="Label" type="Label" parent="Sprite" unique_id=494320078]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@@ -59,6 +59,7 @@ offset_right = -41.5
|
|||||||
offset_bottom = -75.0
|
offset_bottom = -75.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
text = "H"
|
||||||
label_settings = SubResource("LabelSettings_3d2ho")
|
label_settings = SubResource("LabelSettings_3d2ho")
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 2
|
vertical_alignment = 2
|
||||||
|
|||||||
Reference in New Issue
Block a user