Simple lifebar implemented. UI work still in progress.
This commit is contained in:
parent
599d37deeb
commit
ee52522925
19
Main.tscn
19
Main.tscn
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=23 format=2]
|
[gd_scene load_steps=26 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/Backgrounds/bgmuck.png" type="Texture" id=1]
|
[ext_resource path="res://assets/Backgrounds/bgmuck.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://src/playerC/Player.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://src/playerC/Player.tscn" type="PackedScene" id=2]
|
||||||
|
|
@ -9,6 +9,9 @@
|
||||||
[ext_resource path="res://src/enemyC/EnemyC.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://src/enemyC/EnemyC.tscn" type="PackedScene" id=7]
|
||||||
[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=8]
|
[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=8]
|
||||||
[ext_resource path="res://src/UI_Dialog.tscn" type="PackedScene" id=9]
|
[ext_resource path="res://src/UI_Dialog.tscn" type="PackedScene" id=9]
|
||||||
|
[ext_resource path="res://assets/UI/Healthbar.png" type="Texture" id=10]
|
||||||
|
[ext_resource path="res://assets/UI/Healthbar-Indicator.png" type="Texture" id=11]
|
||||||
|
[ext_resource path="res://src/UI/HealthBar.gd" type="Script" id=12]
|
||||||
|
|
||||||
[sub_resource type="ConvexPolygonShape2D" id=2]
|
[sub_resource type="ConvexPolygonShape2D" id=2]
|
||||||
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
|
points = PoolVector2Array( 16, 16, 0, 16, 0, 0, 16, 0 )
|
||||||
|
|
@ -230,3 +233,17 @@ margin_bottom = 53.0
|
||||||
custom_fonts/font = ExtResource( 8 )
|
custom_fonts/font = ExtResource( 8 )
|
||||||
text = "In a world where danger lurks in your plumbing. One thing decides to do another thing and we all determine it wasn't worth it. Hello World"
|
text = "In a world where danger lurks in your plumbing. One thing decides to do another thing and we all determine it wasn't worth it. Hello World"
|
||||||
autowrap = true
|
autowrap = true
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
layer = 2
|
||||||
|
|
||||||
|
[node name="HealthBar" type="TextureProgress" parent="CanvasLayer"]
|
||||||
|
margin_left = 2.0
|
||||||
|
margin_top = 2.0
|
||||||
|
margin_right = 104.0
|
||||||
|
margin_bottom = 14.0
|
||||||
|
value = 50.0
|
||||||
|
texture_under = ExtResource( 10 )
|
||||||
|
texture_progress = ExtResource( 11 )
|
||||||
|
texture_progress_offset = Vector2( 1, 1 )
|
||||||
|
script = ExtResource( 12 )
|
||||||
|
|
|
||||||
BIN
assets/UI/Healthbar-Indicator.png
Normal file
BIN
assets/UI/Healthbar-Indicator.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 174 B |
35
assets/UI/Healthbar-Indicator.png.import
Normal file
35
assets/UI/Healthbar-Indicator.png.import
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/Healthbar-Indicator.png-cbbde6797adcb3b0445dfd4f9ab1961a.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/UI/Healthbar-Indicator.png"
|
||||||
|
dest_files=[ "res://.import/Healthbar-Indicator.png-cbbde6797adcb3b0445dfd4f9ab1961a.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=false
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
||||||
3
assets/UI/Healthbar-Indicator.tres
Normal file
3
assets/UI/Healthbar-Indicator.tres
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[gd_resource type="StreamTexture" format=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
BIN
assets/UI/Healthbar.png
Normal file
BIN
assets/UI/Healthbar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 172 B |
35
assets/UI/Healthbar.png.import
Normal file
35
assets/UI/Healthbar.png.import
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/Healthbar.png-838f5c013355fbdfe1abb6dec9197215.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/UI/Healthbar.png"
|
||||||
|
dest_files=[ "res://.import/Healthbar.png-838f5c013355fbdfe1abb6dec9197215.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=false
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
||||||
16
src/UI/HealthBar.gd
Normal file
16
src/UI/HealthBar.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
extends TextureProgress
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
value = PlayerInfo.player_health
|
||||||
|
|
@ -6,6 +6,8 @@ onready var player_hurtbox = $Hurtbox_Component/CollisionShape2D
|
||||||
|
|
||||||
onready var gun = $Gun
|
onready var gun = $Gun
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
PlayerInfo.player_health = $Health_Component.health
|
||||||
|
|
||||||
#var sound_effects = preload("res://src/playerC/resources/sound_effects.tres")
|
#var sound_effects = preload("res://src/playerC/resources/sound_effects.tres")
|
||||||
|
|
||||||
|
|
@ -40,6 +42,7 @@ func gotcha(damage):
|
||||||
$Health_Component.take_damage(damage)
|
$Health_Component.take_damage(damage)
|
||||||
if $Health_Component.health > 0:
|
if $Health_Component.health > 0:
|
||||||
movement_state_machine.change_state($movement_state_machine/hurt)
|
movement_state_machine.change_state($movement_state_machine/hurt)
|
||||||
|
PlayerInfo.player_health = $Health_Component.health
|
||||||
yield( get_tree().create_timer(2 + $movement_state_machine/hurt.timeout_seconds), "timeout")
|
yield( get_tree().create_timer(2 + $movement_state_machine/hurt.timeout_seconds), "timeout")
|
||||||
$Hurtbox_Component.set_hurtbox(true)
|
$Hurtbox_Component.set_hurtbox(true)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user