diff --git a/assets/fire-ray.svg b/assets/fire-ray.svg new file mode 100644 index 0000000..e0ae6be --- /dev/null +++ b/assets/fire-ray.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/fire-ray.svg.import b/assets/fire-ray.svg.import new file mode 100644 index 0000000..7e95bb4 --- /dev/null +++ b/assets/fire-ray.svg.import @@ -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 diff --git a/assets/high-shot.svg b/assets/high-shot.svg new file mode 100644 index 0000000..aee1c2d --- /dev/null +++ b/assets/high-shot.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/high-shot.svg.import b/assets/high-shot.svg.import new file mode 100644 index 0000000..f798dfb --- /dev/null +++ b/assets/high-shot.svg.import @@ -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 diff --git a/scenes/ability_ph.tscn b/scenes/ability_ph.tscn index 549069d..49955ca 100644 --- a/scenes/ability_ph.tscn +++ b/scenes/ability_ph.tscn @@ -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="."] diff --git a/scenes/testScrollScene.tscn b/scenes/testScrollScene.tscn index 3b02af4..bd3cbff 100644 --- a/scenes/testScrollScene.tscn +++ b/scenes/testScrollScene.tscn @@ -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"] diff --git a/scripts/AbilityPlayer.gd b/scripts/AbilityPlayer.gd index a0aa1e8..a84bf26 100644 --- a/scripts/AbilityPlayer.gd +++ b/scripts/AbilityPlayer.gd @@ -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: diff --git a/scripts/test_scroll_scene.gd b/scripts/test_scroll_scene.gd index a983716..d9f21d7 100644 --- a/scripts/test_scroll_scene.gd +++ b/scripts/test_scroll_scene.gd @@ -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)