lose screen UI; needs animation
This commit is contained in:
parent
28e8a4b6ac
commit
1d0032b587
10 changed files with 300 additions and 45 deletions
|
|
@ -62,6 +62,7 @@ func hit(proj: Node3D, damage: float) -> bool:
|
||||||
health -= damage
|
health -= damage
|
||||||
if health <= 0:
|
if health <= 0:
|
||||||
queue_free()
|
queue_free()
|
||||||
|
SignalBus.enemy_destroyed.emit()
|
||||||
else:
|
else:
|
||||||
if proj is PlayerProjectile:
|
if proj is PlayerProjectile:
|
||||||
knockback = proj.velocity * 2. * knockback_mul * proj.knockback_mul
|
knockback = proj.velocity * 2. * knockback_mul * proj.knockback_mul
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,6 @@ func hit(proj: Node3D, _damage: float) -> bool:
|
||||||
|
|
||||||
parent.queue_free()
|
parent.queue_free()
|
||||||
|
|
||||||
|
SignalBus.perfect_shot_hit.emit()
|
||||||
|
|
||||||
return weak_point_hit
|
return weak_point_hit
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,8 +1,38 @@
|
||||||
extends CanvasLayer
|
extends CanvasLayer
|
||||||
|
|
||||||
|
var buildings_destroyed_count := 0
|
||||||
|
var police_eliminated_count := 0
|
||||||
|
var perfect_shot_count := 0
|
||||||
|
|
||||||
|
@onready var score_label: Label = %Score
|
||||||
|
@onready var buildings_destroyed_label: Label = %BuildingsDestroyed
|
||||||
|
@onready var police_eliminated_label: Label = %PoliceEliminated
|
||||||
|
@onready var perfect_shots_label: Label = %PerfectShots
|
||||||
|
@onready var chase_duration_label: Label = %ChaseDuration
|
||||||
|
@onready var distance_traveled_label: Label = %DistanceTraveled
|
||||||
|
|
||||||
|
func update_labels() -> void:
|
||||||
|
score_label.text = str(ScoreLabel.instance.score)
|
||||||
|
|
||||||
|
buildings_destroyed_label.text = str(buildings_destroyed_count)
|
||||||
|
police_eliminated_label.text = str(police_eliminated_count)
|
||||||
|
perfect_shots_label.text = str(perfect_shot_count)
|
||||||
|
|
||||||
|
var delta = Time.get_ticks_msec() - Level.level.start_time_msec
|
||||||
|
var seconds = delta / 1000
|
||||||
|
var minutes = seconds / 60
|
||||||
|
seconds = seconds % 60
|
||||||
|
chase_duration_label.text = "%d:%02d" % [minutes, seconds]
|
||||||
|
|
||||||
|
distance_traveled_label.text = "%dm" % int(roundf(Player.instance.distance_traveled))
|
||||||
|
|
||||||
func _on_restart_pressed() -> void:
|
func _on_restart_pressed() -> void:
|
||||||
get_tree().reload_current_scene()
|
get_tree().reload_current_scene()
|
||||||
|
|
||||||
func _on_quit_pressed() -> void:
|
func _on_quit_pressed() -> void:
|
||||||
get_tree().quit()
|
get_tree().quit()
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
SignalBus.building_destroyed.connect(func(_b, _s): buildings_destroyed_count += 1)
|
||||||
|
SignalBus.enemy_destroyed.connect(func(): police_eliminated_count += 1)
|
||||||
|
SignalBus.perfect_shot_hit.connect(func(): perfect_shot_count += 1)
|
||||||
|
|
|
||||||
47
parking_citation.tres
Normal file
47
parking_citation.tres
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
[gd_resource type="Theme" format=3 uid="uid://bqs58u70wa6gd"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_16ibj"]
|
||||||
|
bg_color = Color(0.46, 0.46, 0.46, 0.28627452)
|
||||||
|
border_width_left = 3
|
||||||
|
border_width_top = 3
|
||||||
|
border_width_right = 6
|
||||||
|
border_width_bottom = 7
|
||||||
|
border_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dt5rt"]
|
||||||
|
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||||
|
border_width_left = 3
|
||||||
|
border_width_top = 3
|
||||||
|
border_width_right = 6
|
||||||
|
border_width_bottom = 7
|
||||||
|
border_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_myosa"]
|
||||||
|
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||||
|
border_width_left = 3
|
||||||
|
border_width_top = 3
|
||||||
|
border_width_right = 3
|
||||||
|
border_width_bottom = 3
|
||||||
|
border_color = Color(0, 0, 0, 1)
|
||||||
|
expand_margin_left = 5.0
|
||||||
|
expand_margin_top = 5.0
|
||||||
|
expand_margin_right = 5.0
|
||||||
|
expand_margin_bottom = 5.0
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ugcl0"]
|
||||||
|
bg_color = Color(1, 1, 1, 1)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_suww5"]
|
||||||
|
bg_color = Color(1, 1, 1, 1)
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
Button/colors/font_color = Color(0, 0, 0, 1)
|
||||||
|
Button/colors/font_hover_color = Color(0, 0, 0, 1)
|
||||||
|
Button/font_sizes/font_size = 32
|
||||||
|
Button/styles/hover = SubResource("StyleBoxFlat_16ibj")
|
||||||
|
Button/styles/normal = SubResource("StyleBoxFlat_dt5rt")
|
||||||
|
Label/colors/font_color = Color(0, 0, 0, 1)
|
||||||
|
Label/font_sizes/font_size = 28
|
||||||
|
Label/styles/normal = SubResource("StyleBoxFlat_myosa")
|
||||||
|
Panel/styles/panel = SubResource("StyleBoxFlat_ugcl0")
|
||||||
|
PanelContainer/styles/panel = SubResource("StyleBoxFlat_suww5")
|
||||||
|
|
@ -45,6 +45,8 @@ var gun_index := 0:
|
||||||
var gun: Gun:
|
var gun: Gun:
|
||||||
get: return guns[gun_index]
|
get: return guns[gun_index]
|
||||||
|
|
||||||
|
var distance_traveled := 0.
|
||||||
|
|
||||||
func clean_angle(theta: float) -> float:
|
func clean_angle(theta: float) -> float:
|
||||||
theta = fposmod(theta, TAU)
|
theta = fposmod(theta, TAU)
|
||||||
if theta < PI: return theta
|
if theta < PI: return theta
|
||||||
|
|
@ -145,6 +147,7 @@ func _process(delta: float) -> void:
|
||||||
State.NORMAL: _process_movement(delta)
|
State.NORMAL: _process_movement(delta)
|
||||||
State.DASHING: _process_dash()
|
State.DASHING: _process_dash()
|
||||||
State.LOCKED: pass
|
State.LOCKED: pass
|
||||||
|
distance_traveled += velocity.length() * delta
|
||||||
|
|
||||||
|
|
||||||
_process_aim()
|
_process_aim()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
|
class_name ScoreLabel
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
const DESIRED_SCALE := Vector2.ONE * .5
|
const DESIRED_SCALE := Vector2.ONE * .5
|
||||||
|
|
||||||
|
static var instance: ScoreLabel
|
||||||
|
|
||||||
@onready var label: Label = get_child(0)
|
@onready var label: Label = get_child(0)
|
||||||
var tween: Tween
|
var tween: Tween
|
||||||
var _display_score := 0
|
var _display_score := 0
|
||||||
|
|
@ -23,6 +26,9 @@ var score := 0:
|
||||||
func exp_lerp(a: Variant, b: Variant, decay: float, dt: float) -> Variant:
|
func exp_lerp(a: Variant, b: Variant, decay: float, dt: float) -> Variant:
|
||||||
return lerp(a, b, 1 - exp(-decay * dt))
|
return lerp(a, b, 1 - exp(-decay * dt))
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
instance = self
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
scale = DESIRED_SCALE
|
scale = DESIRED_SCALE
|
||||||
score = score
|
score = score
|
||||||
|
|
|
||||||
BIN
ui/vecteezy_crumpled-paper-texture_1227306.jpg
Normal file
BIN
ui/vecteezy_crumpled-paper-texture_1227306.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 MiB |
40
ui/vecteezy_crumpled-paper-texture_1227306.jpg.import
Normal file
40
ui/vecteezy_crumpled-paper-texture_1227306.jpg.import
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bqtkxrfh5yyfn"
|
||||||
|
path="res://.godot/imported/vecteezy_crumpled-paper-texture_1227306.jpg-d5817539067c1b0b5972678c937e9510.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://ui/vecteezy_crumpled-paper-texture_1227306.jpg"
|
||||||
|
dest_files=["res://.godot/imported/vecteezy_crumpled-paper-texture_1227306.jpg-d5817539067c1b0b5972678c937e9510.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
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/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
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,3 +1,5 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
signal building_destroyed(building: Building, score: int)
|
signal building_destroyed(building: Building, score: int)
|
||||||
|
signal enemy_destroyed
|
||||||
|
signal perfect_shot_hit
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue