forked from team-sg/hero-mark-2
boss3 health bars
This commit is contained in:
parent
1274e989b4
commit
21181a24c8
4 changed files with 85 additions and 1 deletions
|
@ -1,3 +1,14 @@
|
|||
extends "res://maps/map.gd"
|
||||
|
||||
|
||||
onready var sg_health: HSlider = $"%SGHealth"
|
||||
onready var fami_health: HSlider = $"%FamiHealth"
|
||||
|
||||
|
||||
|
||||
func _on_2083_health_changed(amount) -> void:
|
||||
sg_health.value = amount
|
||||
|
||||
|
||||
func _on_Famira_health_changed(amount) -> void:
|
||||
fami_health.value = -amount
|
||||
|
|
|
@ -1,14 +1,75 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://objects/enemy/boss/sg2083.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://tilesets/t_laboratory.tres" type="TileSet" id=2]
|
||||
[ext_resource path="res://maps/boss/boss3_arena.gd" type="Script" id=3]
|
||||
[ext_resource path="res://objects/enemy/boss/famira.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://ui/theme.tres" type="Theme" id=5]
|
||||
|
||||
[node name="Map" type="Node2D" groups=["map"]]
|
||||
pause_mode = 1
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="GUI" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Control" type="HBoxContainer" parent="GUI"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 5 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="GUI/Control"]
|
||||
margin_right = 126.0
|
||||
margin_bottom = 192.0
|
||||
size_flags_horizontal = 3
|
||||
alignment = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="GUI/Control/VBoxContainer"]
|
||||
margin_top = 182.0
|
||||
margin_right = 126.0
|
||||
margin_bottom = 192.0
|
||||
|
||||
[node name="Label" type="Label" parent="GUI/Control/VBoxContainer/HBoxContainer"]
|
||||
margin_right = 49.0
|
||||
margin_bottom = 10.0
|
||||
text = "SG 2083"
|
||||
|
||||
[node name="SGHealth" type="HSlider" parent="GUI/Control/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 53.0
|
||||
margin_right = 126.0
|
||||
margin_bottom = 10.0
|
||||
size_flags_horizontal = 3
|
||||
value = 100.0
|
||||
scrollable = false
|
||||
|
||||
[node name="VBoxContainer2" type="VBoxContainer" parent="GUI/Control"]
|
||||
margin_left = 130.0
|
||||
margin_right = 256.0
|
||||
margin_bottom = 192.0
|
||||
size_flags_horizontal = 3
|
||||
alignment = 2
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="GUI/Control/VBoxContainer2"]
|
||||
margin_top = 182.0
|
||||
margin_right = 126.0
|
||||
margin_bottom = 192.0
|
||||
|
||||
[node name="FamiHealth" type="HSlider" parent="GUI/Control/VBoxContainer2/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 80.0
|
||||
margin_bottom = 10.0
|
||||
size_flags_horizontal = 3
|
||||
min_value = -100.0
|
||||
max_value = 0.0
|
||||
value = -100.0
|
||||
scrollable = false
|
||||
|
||||
[node name="Label" type="Label" parent="GUI/Control/VBoxContainer2/HBoxContainer"]
|
||||
margin_left = 84.0
|
||||
margin_right = 126.0
|
||||
margin_bottom = 10.0
|
||||
text = "Famira"
|
||||
|
||||
[node name="TileMap" type="TileMap" parent="."]
|
||||
tile_set = ExtResource( 2 )
|
||||
cell_size = Vector2( 8, 8 )
|
||||
|
@ -27,3 +88,6 @@ current = true
|
|||
[node name="Famira" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 185, 176 )
|
||||
sg2083_path = NodePath("../2083")
|
||||
|
||||
[connection signal="health_changed" from="2083" to="." method="_on_2083_health_changed"]
|
||||
[connection signal="health_changed" from="Famira" to="." method="_on_Famira_health_changed"]
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
extends Node2D
|
||||
|
||||
|
||||
signal health_changed(amount)
|
||||
|
||||
|
||||
export var push_speed: float = 60.0
|
||||
export var chase_speed: float = 40.0
|
||||
export var breath_dps: float = 50.0
|
||||
|
@ -43,6 +46,7 @@ func stop_push() -> void:
|
|||
|
||||
func hurt(amount: float) -> void:
|
||||
hp -= amount
|
||||
emit_signal("health_changed", hp)
|
||||
if hp <= 0.0:
|
||||
state_chart.send_event("die")
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
|
||||
signal died()
|
||||
signal health_changed(amount)
|
||||
|
||||
|
||||
enum State {DEAD, STAND, FORWARD, BACK, DUCK, BEAM}
|
||||
|
||||
const Bullet = preload("res://objects/enemy/2600_bullet.tscn")
|
||||
|
@ -78,6 +82,7 @@ func hurt(amount: float, can_duck: bool = false) -> void:
|
|||
if can_duck and state == State.DUCK:
|
||||
return
|
||||
hp -= amount
|
||||
emit_signal("health_changed", hp)
|
||||
if state != State.DEAD and hp <= 0.0:
|
||||
state = State.DEAD
|
||||
anims.play("die")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue