-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part 07 - enemy unit healthbars, explosions
- Loading branch information
Chris Bradfield
committed
May 6, 2018
1 parent
14930d6
commit 2718b00
Showing
7 changed files
with
123 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[gd_scene load_steps=12 format=2] | ||
|
||
[ext_resource path="res://assets/explosions/explosion1.png" type="Texture" id=1] | ||
[ext_resource path="res://assets/explosions/explosion2.png" type="Texture" id=2] | ||
[ext_resource path="res://assets/explosions/explosion3.png" type="Texture" id=3] | ||
[ext_resource path="res://assets/explosions/explosion4.png" type="Texture" id=4] | ||
[ext_resource path="res://assets/explosions/explosion5.png" type="Texture" id=5] | ||
[ext_resource path="res://assets/explosions/explosionSmoke1.png" type="Texture" id=6] | ||
[ext_resource path="res://assets/explosions/explosionSmoke2.png" type="Texture" id=7] | ||
[ext_resource path="res://assets/explosions/explosionSmoke3.png" type="Texture" id=8] | ||
[ext_resource path="res://assets/explosions/explosionSmoke4.png" type="Texture" id=9] | ||
[ext_resource path="res://assets/explosions/explosionSmoke5.png" type="Texture" id=10] | ||
|
||
[sub_resource type="SpriteFrames" id=1] | ||
|
||
animations = [ { | ||
"frames": [ ExtResource( 1 ), ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ) ], | ||
"loop": true, | ||
"name": "fire", | ||
"speed": 12.0 | ||
}, { | ||
"frames": [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 9 ), ExtResource( 10 ) ], | ||
"loop": true, | ||
"name": "smoke", | ||
"speed": 12.0 | ||
} ] | ||
|
||
[node name="Explosion" type="AnimatedSprite"] | ||
|
||
frames = SubResource( 1 ) | ||
animation = "smoke" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
extends Node2D | ||
|
||
var bar_red = preload("res://assets/UI/barHorizontal_red_mid 200.png") | ||
var bar_green = preload("res://assets/UI/barHorizontal_green_mid 200.png") | ||
var bar_yellow = preload("res://assets/UI/barHorizontal_yellow_mid 200.png") | ||
|
||
func _ready(): | ||
for node in get_children(): | ||
node.hide() | ||
|
||
func _process(delta): | ||
global_rotation = 0 | ||
|
||
func update_healthbar(value): | ||
$HealthBar.texture_progress = bar_green | ||
if value < 60: | ||
$HealthBar.texture_progress = bar_yellow | ||
if value < 25: | ||
$HealthBar.texture_progress = bar_red | ||
if value < 100: | ||
$HealthBar.show() | ||
$HealthBar.value = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[gd_scene load_steps=3 format=2] | ||
|
||
[ext_resource path="res://ui/UnitDisplay.gd" type="Script" id=1] | ||
[ext_resource path="res://assets/UI/barHorizontal_green_mid 200.png" type="Texture" id=2] | ||
|
||
[node name="UnitDisplay" type="Node2D"] | ||
|
||
scale = Vector2( 0.5, 0.5 ) | ||
script = ExtResource( 1 ) | ||
_sections_unfolded = [ "Transform", "Z Index" ] | ||
|
||
[node name="HealthBar" type="TextureProgress" parent="." index="0"] | ||
|
||
anchor_left = 0.0 | ||
anchor_top = 0.0 | ||
anchor_right = 0.0 | ||
anchor_bottom = 0.0 | ||
margin_left = -100.0 | ||
margin_top = -156.0 | ||
margin_right = 100.0 | ||
margin_bottom = -116.0 | ||
rect_pivot_offset = Vector2( 0, 0 ) | ||
rect_clip_content = false | ||
mouse_filter = 1 | ||
mouse_default_cursor_shape = 0 | ||
size_flags_horizontal = 1 | ||
size_flags_vertical = 1 | ||
min_value = 0.0 | ||
max_value = 100.0 | ||
step = 1.0 | ||
page = 0.0 | ||
value = 100.0 | ||
exp_edit = false | ||
rounded = false | ||
texture_under = null | ||
texture_over = null | ||
texture_progress = ExtResource( 2 ) | ||
radial_fill_degrees = 360.0 | ||
radial_center_offset = Vector2( 0, 0 ) | ||
nine_patch_stretch = false | ||
_sections_unfolded = [ "Textures" ] | ||
|
||
|