implement basic full abilitybar

This commit is contained in:
tonydero 2024-10-15 16:35:03 -06:00
parent 7844cad018
commit 1496610364
8 changed files with 178 additions and 43 deletions

1
assets/fire-ray.svg Normal file
View File

@ -0,0 +1 @@
<svg style="height: 64px; width: 64px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M0 0h512v512H0z" fill="#000" fill-opacity="1"></path><g class="" style="" transform="translate(0,0)"><path d="M12.195 20.94v39.128c76.452 73.026 151.387 152.574 187.47 215.5 12.6 21.978 38.114 72.972 49.056 118.557-31.424-3.388-64.762-14.633-96.36-33.873 11.605 19.025 25.57 37.838 42.632 54.898 83.895 83.897 200.548 103.142 260.473 43.217 59.927-59.927 40.678-176.574-43.22-260.47-17.062-17.063-35.872-31.028-54.895-42.633 21.316 35.01 33.27 71.947 35.04 106.29-47.3-13.436-103.76-38.565-127.316-51.976C201.59 173.434 121.32 98.073 47.818 20.938H12.195zM374.89 285.866c47.63 0 86.557 36.296 90.727 82.817-12.225-22.7-36.207-38.133-63.797-38.133-39.995 0-72.42 32.423-72.42 72.42 0 5.462.61 10.78 1.758 15.897 2.835-21.18 21.098-37.674 43.018-37.674 23.866 0 43.414 19.55 43.414 43.414 0 23.866-19.548 43.413-43.414 43.413-1.59 0-3.157-.093-4.703-.262.114.057.225.12.34.176-48.052-2.623-86.028-42.24-86.028-90.96 0-50.428 40.677-91.107 91.104-91.107z" fill="#f5a623" fill-opacity="1" style="--darkreader-inline-fill: #1b1b1a;" data-darkreader-inline-fill=""></path></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://3cx8asej7yqn"
path="res://.godot/imported/fire-ray.svg-445abd185ac0d175bc0bb96dc9de79ad.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/fire-ray.svg"
dest_files=["res://.godot/imported/fire-ray.svg-445abd185ac0d175bc0bb96dc9de79ad.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

1
assets/high-shot.svg Normal file
View File

@ -0,0 +1 @@
<svg style="height: 64px; width: 64px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M0 0h512v512H0z" fill="#000" fill-opacity="1"></path><g class="" style="" transform="translate(0,0)"><path d="M492.656 20.406l-118.594 56.22L413.875 86l-86.97 86.97-305.5 259.374.69.687 104.75-47.467-46.376 105.843.905.906 272.5-319.875 73.22-73.218 9.342 39.81 56.22-118.624zm-473.25.063c-1.347 23.43 5 39.947 16.563 52.218l24.093 302.28 17.562-14.874-21.72-272.438c57.975 31.954 169.096 25.165 216.907 106.72l66.625-56.564 1.22-1.218C292.74 38.666 86.01 99.716 19.406 20.47zm359.531 151.56l-1.156 1.157-57.25 67.188c82.006 47.945 75.587 159.267 107.283 218.03l-272.157-24.5-14.812 17.408 301.562 27.125c12.48 12.283 29.4 19.084 53.688 17.687-79.95-67.2-18.36-275.754-117.156-324.094z" fill="#9b7e4f" fill-opacity="1"></path></g></svg>

After

Width:  |  Height:  |  Size: 842 B

View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dvvtnenxps3yu"
path="res://.godot/imported/high-shot.svg-250a62ddc65dcb2f1f132f3bc05c4d81.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/high-shot.svg"
dest_files=["res://.godot/imported/high-shot.svg-250a62ddc65dcb2f1f132f3bc05c4d81.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@ -1,13 +1,13 @@
[gd_scene load_steps=3 format=3 uid="uid://dvwo26vsk46tl"]
[ext_resource type="Texture2D" uid="uid://b10c1776j6j60" path="res://assets/icon.svg" id="1_eoss7"]
[ext_resource type="Texture2D" uid="uid://dvvtnenxps3yu" path="res://assets/high-shot.svg" id="1_djmgc"]
[ext_resource type="Script" path="res://scripts/AbilityPlayer.gd" id="2_l8ort"]
[node name="AbilityPH" type="TextureRect"]
offset_right = 128.0
offset_bottom = 128.0
scale = Vector2(0.5, 0.5)
texture = ExtResource("1_eoss7")
offset_right = 512.0
offset_bottom = 512.0
texture = ExtResource("1_djmgc")
expand_mode = 1
script = ExtResource("2_l8ort")
[node name="IdleCooldown" type="Timer" parent="."]

View File

@ -35,69 +35,124 @@ theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="BottomUI" type="VBoxContainer" parent="MarginContainer"]
[node name="UIBottom" type="HBoxContainer" parent="MarginContainer"]
layout_mode = 2
size_flags_vertical = 8
[node name="PlayerInfo" type="VBoxContainer" parent="MarginContainer/UIBottom"]
layout_mode = 2
size_flags_horizontal = 3
[node name="PlayerHealthbar" type="ProgressBar" parent="MarginContainer/UIBottom/PlayerInfo"]
layout_mode = 2
size_flags_vertical = 2
[node name="UIBottomCenter" type="VBoxContainer" parent="MarginContainer/UIBottom"]
custom_minimum_size = Vector2(384, 0)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="AbilityBar" type="HBoxContainer" parent="MarginContainer/UIBottom/UIBottomCenter"]
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 6
alignment = 1
[node name="AbilityA1" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("2_heria")]
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
[node name="AbilityA2" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("2_heria")]
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
size_flags_horizontal = 6
attack_damage = 500
attack_speed = 3.5
[node name="AbilityA3" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("2_heria")]
visible = false
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
size_flags_horizontal = 6
[node name="AbilityA4" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("2_heria")]
visible = false
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
size_flags_horizontal = 6
[node name="AbilityB1" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("2_heria")]
visible = false
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
size_flags_horizontal = 6
[node name="AbilityB2" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("2_heria")]
visible = false
custom_minimum_size = Vector2(64, 64)
layout_mode = 2
size_flags_horizontal = 6
[node name="MenuButtons" type="HBoxContainer" parent="MarginContainer/UIBottom/UIBottomCenter"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="AbilityBar" type="HBoxContainer" parent="MarginContainer/BottomUI"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="AbilityPH" parent="MarginContainer/BottomUI/AbilityBar" instance=ExtResource("2_heria")]
layout_mode = 2
[node name="MenuButtons" type="HBoxContainer" parent="MarginContainer/BottomUI"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="MainMenuButton" type="Button" parent="MarginContainer/BottomUI/MenuButtons"]
[node name="MainMenuButton" type="Button" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons"]
layout_mode = 2
text = "Menu"
[node name="MapMenuButton" type="Button" parent="MarginContainer/BottomUI/MenuButtons"]
[node name="MapMenuButton" type="Button" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons"]
layout_mode = 2
text = "Map"
[node name="SkillsMenuButton" type="Button" parent="MarginContainer/BottomUI/MenuButtons"]
[node name="SkillsMenuButton" type="Button" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons"]
layout_mode = 2
text = "Skills"
[node name="InvMenuButton" type="Button" parent="MarginContainer/BottomUI/MenuButtons"]
[node name="InvMenuButton" type="Button" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons"]
layout_mode = 2
text = "Inventory"
[node name="LogMenuButton" type="Button" parent="MarginContainer/BottomUI/MenuButtons"]
[node name="LogMenuButton" type="Button" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons"]
layout_mode = 2
text = "Log"
[node name="CraftMenuButton" type="Button" parent="MarginContainer/BottomUI/MenuButtons"]
[node name="CraftMenuButton" type="Button" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons"]
layout_mode = 2
text = "Crafting"
[node name="DebugMenu" type="HBoxContainer" parent="MarginContainer/BottomUI/MenuButtons"]
[node name="DebugMenu" type="HBoxContainer" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="ButtonTest" type="Button" parent="MarginContainer/BottomUI/MenuButtons/DebugMenu"]
[node name="ButtonTest" type="Button" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons/DebugMenu"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
text = "Complete Quest"
[node name="TouchScreenButton" type="TouchScreenButton" parent="MarginContainer/BottomUI/MenuButtons/DebugMenu/ButtonTest"]
[node name="TouchScreenButton" type="TouchScreenButton" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons/DebugMenu/ButtonTest"]
[node name="ButtonExit" type="Button" parent="MarginContainer/BottomUI/MenuButtons/DebugMenu"]
[node name="ButtonExit" type="Button" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons/DebugMenu"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
text = "Exit"
[node name="TouchScreenButton" type="TouchScreenButton" parent="MarginContainer/BottomUI/MenuButtons/DebugMenu/ButtonExit"]
[node name="TouchScreenButton" type="TouchScreenButton" parent="MarginContainer/UIBottom/UIBottomCenter/MenuButtons/DebugMenu/ButtonExit"]
[node name="Player2FollowerInfo" type="VBoxContainer" parent="MarginContainer/UIBottom"]
layout_mode = 2
size_flags_horizontal = 3
[node name="P2FHealthbar" type="ProgressBar" parent="MarginContainer/UIBottom/Player2FollowerInfo"]
visible = false
layout_mode = 2
[connection signal="timeout" from="SpawnTimer" to="." method="_on_spawn_timer_timeout"]
[connection signal="pressed" from="MarginContainer/BottomUI/MenuButtons/DebugMenu/ButtonTest" to="." method="_on_button_test_pressed"]
[connection signal="pressed" from="MarginContainer/BottomUI/MenuButtons/DebugMenu/ButtonExit" to="." method="_on_button_exit_pressed"]
[connection signal="pressed" from="MarginContainer/UIBottom/UIBottomCenter/MenuButtons/DebugMenu/ButtonTest" to="." method="_on_button_test_pressed"]
[connection signal="pressed" from="MarginContainer/UIBottom/UIBottomCenter/MenuButtons/DebugMenu/ButtonExit" to="." method="_on_button_exit_pressed"]

View File

@ -8,6 +8,8 @@ var playerPos
@export var attack_range := 0
@export var attack_type := "single_target"
@export var attack_damage := 200
@export var attack_speed := 1.0
func _ready() -> void:
@ -16,6 +18,7 @@ func _ready() -> void:
func _process(_delta: float) -> void:
playerPos = Vector2(middleX, get_viewport_rect().size.y*(0.75))
$IdleCooldown.wait_time = attack_speed
func _get_enemies() -> Array:
@ -34,6 +37,7 @@ func _get_distance_to_player(enemy: Node) -> float:
func _get_target(enemies) -> Node:
# var numEnemies := _get_num_enemies()
# TODO implement range, i.e. closest within range
var enemyDists
var closestEnemy
# get list of distances by mapping distance to each node in enemies
@ -45,9 +49,9 @@ func _get_target(enemies) -> Node:
func _deal_idle_damage(enemiesList) -> void:
var damage = 200
var target = _get_target(enemiesList)
target.damageTaken += damage
if self.visible:
target.damageTaken += attack_damage
func _on_idle_cooldown_timeout() -> void:

View File

@ -13,17 +13,17 @@ var playerPos
func _ready() -> void:
middleX = get_viewport_rect().size.x/2
playerPos = Vector2(middleX, get_viewport_rect().size.y*(0.75))
middleX = get_viewport_rect().size.x / 2
playerPos = Vector2(middleX, get_viewport_rect().size.y * (0.75))
if not debug:
$MarginContainer/Menus/MenuButtons/DebugMenu.hide()
$SpawnTimer.start(spawnTimerValue)
_spawn_enemies(5)
_spawn_enemies(5)
_spawn_enemies(1)
# _spawn_enemies(5)
func _process(delta: float) -> void:
playerPos = Vector2(middleX, get_viewport_rect().size.y*(0.75))
playerPos = Vector2(middleX, get_viewport_rect().size.y * (0.75))
if questsComplete:
$SpawnTimer.stop()
if _get_enemies().is_empty():
@ -33,7 +33,7 @@ func _process(delta: float) -> void:
func _create_enemy():
var enemy = load("res://scenes/enemy.tscn").instantiate()
enemy.scale = Vector2.ONE*0.5
enemy.scale = Vector2.ONE * 0.5
enemy.position = Vector2(randi_range(0, get_viewport_rect().size.x), -50)
enemy.speed *= randf_range(0.5, 2.0)
enemy.target = playerPos
@ -50,9 +50,9 @@ func _get_num_enemies() -> int:
return len(enemies)
func _spawn_enemies(maxEnemies: int) -> void:
func _spawn_enemies(numEnemies: int) -> void:
#await get_tree().create_timer(time).timeout
var numEnemies = randi_range(1, maxEnemies)
# var numEnemies = randi_range(1, maxEnemies)
for i in range(numEnemies):
var enemy = _create_enemy()
%SpawnArea.add_child(enemy)
@ -69,4 +69,4 @@ func _on_button_exit_pressed() -> void:
func _on_spawn_timer_timeout() -> void:
_spawn_enemies(5)
_spawn_enemies(1)