Compare commits
3 Commits
6b70c0562f
...
3a2d8435e4
Author | SHA1 | Date | |
---|---|---|---|
3a2d8435e4
|
|||
c04e6b3a34
|
|||
dec0901b3d
|
4
assets/sprites/64x64_placeholder.tres
Normal file
4
assets/sprites/64x64_placeholder.tres
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[gd_resource type="PlaceholderTexture2D" format=3 uid="uid://baxbllvlqssur"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
size = Vector2(64, 64)
|
BIN
assets/sprites/sword_icon.aseprite
(Stored with Git LFS)
Normal file
BIN
assets/sprites/sword_icon.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/sprites/sword_icon.png
(Stored with Git LFS)
Normal file
BIN
assets/sprites/sword_icon.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
assets/sprites/sword_icon.png.import
Normal file
34
assets/sprites/sword_icon.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dmx6sb6pbl87a"
|
||||||
|
path="res://.godot/imported/sword_icon.png-de4b5a0b4f6474e5da4bcd50ba4fc374.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/sprites/sword_icon.png"
|
||||||
|
dest_files=["res://.godot/imported/sword_icon.png-de4b5a0b4f6474e5da4bcd50ba4fc374.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
|
@@ -19,7 +19,7 @@ const GROUP_PICKUP = "pickup"
|
|||||||
|
|
||||||
enum ModRarity { LEGENDARY, EPIC, RARE, NORMAL }
|
enum ModRarity { LEGENDARY, EPIC, RARE, NORMAL }
|
||||||
|
|
||||||
var placeholder_tex: Texture2D
|
const placeholder_tex = preload("res://assets/sprites/64x64_placeholder.tres")
|
||||||
|
|
||||||
var MOD_CHOICES = [
|
var MOD_CHOICES = [
|
||||||
{
|
{
|
||||||
@@ -80,11 +80,6 @@ var MOD_CHOICES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
placeholder_tex = PlaceholderTexture2D.new()
|
|
||||||
placeholder_tex.size = Vector2(64.0, 64.0)
|
|
||||||
|
|
||||||
|
|
||||||
func _draw_random_choice(fortune: float = 1.0) -> Dictionary:
|
func _draw_random_choice(fortune: float = 1.0) -> Dictionary:
|
||||||
var total_weight: int = 0
|
var total_weight: int = 0
|
||||||
for choice in MOD_CHOICES:
|
for choice in MOD_CHOICES:
|
||||||
@@ -107,6 +102,7 @@ func draw_random_mod(fortune: float = 1.0) -> PlayerStatsModifier:
|
|||||||
mod.description = choice["description"]
|
mod.description = choice["description"]
|
||||||
mod.internal_name = choice["internal_name"]
|
mod.internal_name = choice["internal_name"]
|
||||||
mod.tex = choice["tex"]
|
mod.tex = choice["tex"]
|
||||||
|
print_debug("gc: %s" % mod.tex)
|
||||||
mod.title = choice["name"]
|
mod.title = choice["name"]
|
||||||
|
|
||||||
return mod
|
return mod
|
||||||
|
@@ -47,9 +47,9 @@ func update_debug_stats() -> void:
|
|||||||
for stat in debug_stats:
|
for stat in debug_stats:
|
||||||
# Create margin container
|
# Create margin container
|
||||||
var mc: MarginContainer = MarginContainer.new()
|
var mc: MarginContainer = MarginContainer.new()
|
||||||
mc.add_theme_constant_override("margin_top", 10)
|
mc.add_theme_constant_override("margin_top", 2)
|
||||||
mc.add_theme_constant_override("margin_left", 20)
|
mc.add_theme_constant_override("margin_left", 20)
|
||||||
mc.add_theme_constant_override("margin_bottom", 10)
|
mc.add_theme_constant_override("margin_bottom", 2)
|
||||||
mc.add_theme_constant_override("margin_right", 20)
|
mc.add_theme_constant_override("margin_right", 20)
|
||||||
stats_container_vbox.add_child(mc)
|
stats_container_vbox.add_child(mc)
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@ func _ready() -> void:
|
|||||||
upgrade_name.text = mod.title
|
upgrade_name.text = mod.title
|
||||||
upgrade_description.text = mod.description
|
upgrade_description.text = mod.description
|
||||||
upgrade_tex.texture = mod.tex
|
upgrade_tex.texture = mod.tex
|
||||||
|
print_debug("tex: %s" % mod.tex)
|
||||||
|
|
||||||
|
|
||||||
func _on_pick_button_pressed() -> void:
|
func _on_pick_button_pressed() -> void:
|
||||||
|
@@ -4,9 +4,42 @@ extends Control
|
|||||||
@onready var hp_bar: ProgressBar = $CenterContainer/VBoxContainer/ProgressBar
|
@onready var hp_bar: ProgressBar = $CenterContainer/VBoxContainer/ProgressBar
|
||||||
@onready var elapsed_label: Label = $CenterContainer/VBoxContainer/ElapsedLabel
|
@onready var elapsed_label: Label = $CenterContainer/VBoxContainer/ElapsedLabel
|
||||||
|
|
||||||
|
const ANIM_SPEED = 4.0
|
||||||
|
const TRESHOLD = 1
|
||||||
|
|
||||||
func set_hp(value: float):
|
var wanted_hp_value: float
|
||||||
hp_bar.value = value
|
var wanted_hp_max: float
|
||||||
|
|
||||||
|
var player: Player
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
player = get_tree().get_first_node_in_group("player")
|
||||||
|
if player:
|
||||||
|
hp_bar.value = player.player_stats.current_health
|
||||||
|
hp_bar.max_value = player.player_stats.max_health
|
||||||
|
|
||||||
|
|
||||||
|
func update_hp():
|
||||||
|
if not player:
|
||||||
|
push_error("cant update hp, no player found")
|
||||||
|
var current_hp = player.player_stats.get_final("current_health", player.modifiers)
|
||||||
|
var max_hp = player.player_stats.get_final("max_health", player.modifiers)
|
||||||
|
wanted_hp_value = current_hp
|
||||||
|
wanted_hp_max = max_hp
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if wanted_hp_max != hp_bar.max_value:
|
||||||
|
print_debug("wanted: %f-%f" % [wanted_hp_max, hp_bar.max_value])
|
||||||
|
hp_bar.max_value = lerpf(hp_bar.max_value, wanted_hp_max, ANIM_SPEED * delta)
|
||||||
|
if abs(hp_bar.max_value - wanted_hp_max) < TRESHOLD:
|
||||||
|
hp_bar.max_value = wanted_hp_max
|
||||||
|
if wanted_hp_value != hp_bar.value:
|
||||||
|
print_debug("current: %f-%f" % [wanted_hp_value, hp_bar.value])
|
||||||
|
hp_bar.value = lerpf(hp_bar.value, wanted_hp_value, ANIM_SPEED * delta)
|
||||||
|
if abs(hp_bar.value - wanted_hp_value) < TRESHOLD:
|
||||||
|
hp_bar.value = wanted_hp_value
|
||||||
|
|
||||||
|
|
||||||
func set_elapsed_time(value: float):
|
func set_elapsed_time(value: float):
|
||||||
|
@@ -15,7 +15,7 @@ var god_mode: bool = false
|
|||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
camera.position = global_position
|
camera.position = global_position
|
||||||
main_ui.player_ui.set_hp(100)
|
main_ui.player_ui.update_hp()
|
||||||
GlobalConst.sig_debug_god_mode.connect(toggle_god_mode)
|
GlobalConst.sig_debug_god_mode.connect(toggle_god_mode)
|
||||||
|
|
||||||
|
|
||||||
@@ -42,13 +42,16 @@ func take_damage(value: float) -> void:
|
|||||||
player_stats.current_health = clampf(
|
player_stats.current_health = clampf(
|
||||||
player_stats.current_health, -1.0, player_stats.get_final("max_health", modifiers)
|
player_stats.current_health, -1.0, player_stats.get_final("max_health", modifiers)
|
||||||
)
|
)
|
||||||
|
var current_hp = player_stats.get_final("current_health", modifiers)
|
||||||
|
var max_hp = player_stats.get_final("max_health", modifiers)
|
||||||
|
GlobalConst.sig_debug_stats_set.emit("current_health", "%f" % current_hp)
|
||||||
|
GlobalConst.sig_debug_stats_set.emit("max_hp", "%f" % max_hp)
|
||||||
|
|
||||||
var dm = preload("res://scenes/damage_numbers.tscn").instantiate()
|
var dm = preload("res://scenes/damage_numbers.tscn").instantiate()
|
||||||
dm.damage_taken = value
|
dm.damage_taken = value
|
||||||
dm.player_damage = false
|
dm.player_damage = false
|
||||||
add_child(dm)
|
add_child(dm)
|
||||||
main_ui.player_ui.set_hp(
|
main_ui.player_ui.update_hp()
|
||||||
(player_stats.current_health / player_stats.get_final("max_health", modifiers)) * 100
|
|
||||||
)
|
|
||||||
if player_stats.current_health <= 0:
|
if player_stats.current_health <= 0:
|
||||||
die()
|
die()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user