Compare commits

..

No commits in common. "85f7d32f71aaa79071feab4898a43a75c4b32851" and "9b05276ad6e80f95b105279a8ed6d2f07dc46804" have entirely different histories.

15 changed files with 22 additions and 82 deletions

View file

@ -1,23 +1,10 @@
class_name ActiveItem extends Item class_name ActiveItem extends Item
@onready var active_item_uses = get_tree().get_root().get_node_or_null("main/UIOverlay/ActiveItemUses")
@export var sprite : Texture2D @export var sprite : Texture2D
@export var uses_left_icon : PackedScene
@export var uses = 1:
set(new_uses):
uses = new_uses
if active_item_uses != null:
while active_item_uses.get_children().size() > uses:
active_item_uses.remove_child(active_item_uses.get_child(0))
while active_item_uses.get_children().size() < uses:
if uses_left_icon != null:
active_item_uses.add_child(uses_left_icon.instantiate())
func collect() -> bool: func collect() -> bool:
if (player.active_item == null): if (player.active_item == null):
player.active_item = self player.active_item = self
uses = uses
actually_collect() actually_collect()
return true return true
@ -26,17 +13,7 @@ func collect() -> bool:
func actually_collect(): func actually_collect():
pass pass
func trigger_activation():
activate()
if uses != -1:
uses -= 1
if uses == 0:
remove()
func activate(): func activate():
assert(false) assert(false)
func remove():
uses = 0
player.active_item = null
self.queue_free()

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

View file

@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://bavoghl2pxs83" uid="uid://bavoghl2pxs83"
path="res://.godot/imported/arrow.png-11da51178d457b4db8d73e91ed37096d.ctex" path="res://.godot/imported/arror.png-9ea2fbd842e6807dfd42e9ceed411fd2.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://items/active_items/bow/arrow.png" source_file="res://items/active_items/bow/arror.png"
dest_files=["res://.godot/imported/arrow.png-11da51178d457b4db8d73e91ed37096d.ctex"] dest_files=["res://.godot/imported/arror.png-9ea2fbd842e6807dfd42e9ceed411fd2.ctex"]
[params] [params]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://dfva4dhflxglr"] [gd_scene load_steps=4 format=3 uid="uid://dfva4dhflxglr"]
[ext_resource type="Script" uid="uid://bglrm0bb4nla" path="res://items/active_items/bow/arrow.gd" id="1_lxthq"] [ext_resource type="Script" uid="uid://bglrm0bb4nla" path="res://items/active_items/bow/arrow.gd" id="1_lxthq"]
[ext_resource type="Texture2D" uid="uid://bavoghl2pxs83" path="res://items/active_items/bow/arrow.png" id="2_ilsew"] [ext_resource type="Texture2D" uid="uid://bavoghl2pxs83" path="res://items/active_items/bow/arror.png" id="2_ilsew"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_tfcgf"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_tfcgf"]
size = Vector2(20, 5) size = Vector2(20, 5)

View file

@ -1,9 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://bu3j6ambrybd2"]
[ext_resource type="Texture2D" uid="uid://bavoghl2pxs83" path="res://items/active_items/bow/arrow.png" id="1_7lvex"]
[node name="TextureRect" type="TextureRect"]
custom_minimum_size = Vector2(0, 3)
texture = ExtResource("1_7lvex")
expand_mode = 3
stretch_mode = 3

View file

@ -1,5 +1,5 @@
extends ActiveItem extends ActiveItem
@export var cooldown = 0.3 @export var cooldown = 1
@export var arrow_scene : PackedScene @export var arrow_scene : PackedScene
func actually_collect(): func actually_collect():

View file

@ -1,10 +1,9 @@
[gd_scene load_steps=10 format=3 uid="uid://ddn025xnjngko"] [gd_scene load_steps=9 format=3 uid="uid://ddn025xnjngko"]
[ext_resource type="Script" uid="uid://bkcip66at5sug" path="res://items/active_items/bow/bow.gd" id="1_xppub"] [ext_resource type="Script" uid="uid://bkcip66at5sug" path="res://items/active_items/bow/bow.gd" id="1_xppub"]
[ext_resource type="PackedScene" uid="uid://dfva4dhflxglr" path="res://items/active_items/bow/arrow.tscn" id="2_0id2q"] [ext_resource type="PackedScene" uid="uid://dfva4dhflxglr" path="res://items/active_items/bow/arrow.tscn" id="2_0id2q"]
[ext_resource type="Texture2D" uid="uid://d01h01le82gyh" path="res://items/active_items/bow/bow.png" id="3_vkelq"] [ext_resource type="Texture2D" uid="uid://d01h01le82gyh" path="res://items/active_items/bow/bow.png" id="3_vkelq"]
[ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="4_0id2q"] [ext_resource type="PackedScene" uid="uid://chs0u61f45nau" path="res://utils/earth_aligner.tscn" id="4_0id2q"]
[ext_resource type="PackedScene" uid="uid://bu3j6ambrybd2" path="res://items/active_items/bow/arrow_icon.tscn" id="4_2dslu"]
[ext_resource type="AudioStream" uid="uid://bg1w0fyeyys2p" path="res://sounds/item-equip-6904.mp3" id="5_gfbg0"] [ext_resource type="AudioStream" uid="uid://bg1w0fyeyys2p" path="res://sounds/item-equip-6904.mp3" id="5_gfbg0"]
[ext_resource type="Texture2D" uid="uid://d4mrbgfl7jpqq" path="res://items/ItemShine.png" id="5_o1smo"] [ext_resource type="Texture2D" uid="uid://d4mrbgfl7jpqq" path="res://items/ItemShine.png" id="5_o1smo"]
[ext_resource type="AudioStream" uid="uid://10ljbd4djqgb" path="res://sounds/263675__porkmuncher__bow_release_cut.wav" id="7_o1smo"] [ext_resource type="AudioStream" uid="uid://10ljbd4djqgb" path="res://sounds/263675__porkmuncher__bow_release_cut.wav" id="7_o1smo"]
@ -18,8 +17,6 @@ collision_mask = 4
script = ExtResource("1_xppub") script = ExtResource("1_xppub")
arrow_scene = ExtResource("2_0id2q") arrow_scene = ExtResource("2_0id2q")
sprite = ExtResource("3_vkelq") sprite = ExtResource("3_vkelq")
uses_left_icon = ExtResource("4_2dslu")
uses = 5
icon = ExtResource("3_vkelq") icon = ExtResource("3_vkelq")
item_name = "Bow" item_name = "Bow"

View file

@ -1,12 +1,13 @@
extends ActiveItem extends ActiveItem
@export var cooldown = 0.2 var cooldown = 1.5
var dash_time = 0.15 var dash_time = 0.15
var dash_timer : SceneTreeTimer var dashing = 0
var dash_dir var dash_dir
func _process(delta: float) -> void: func _process(delta: float) -> void:
super(delta) super(delta)
if dash_timer != null and dash_timer.time_left > 0: if dashing > 0:
dashing -= delta
player.reset_to_velocity = player.earth_aligner.local_from_global(dash_dir) player.reset_to_velocity = player.earth_aligner.local_from_global(dash_dir)
@ -17,14 +18,6 @@ func activate():
$DashSound.play() $DashSound.play()
player.activate_cooldown() player.activate_cooldown()
player.air_jumps_current = min(player.air_jumps_current + 1, player.air_jumps_max) player.air_jumps_current = min(player.air_jumps_current + 1, player.air_jumps_max)
dash_timer = get_tree().create_timer(dash_time) dashing = dash_time
dash_dir = player.earth_aligner.global_from_local(Vector2.RIGHT * player.facing * 1600) dash_dir = player.earth_aligner.global_from_local(Vector2.RIGHT * player.facing * 1600)
player.inv_time = max(player.inv_time, dash_time) player.inv_time = max(player.inv_time, dash_time)
func remove():
if(dash_timer != null):
player.active_item = null
await dash_timer.timeout
super()
else:
super()

View file

@ -4,6 +4,7 @@ var cooldown = 10
func actually_collect(): func actually_collect():
player.set_cooldown(cooldown) player.set_cooldown(cooldown)
func activate(): func activate():
$UpdashSound.play() $UpdashSound.play()
player.activate_cooldown() player.activate_cooldown()

View file

@ -13,6 +13,6 @@
[resource] [resource]
script = ExtResource("6_rli0f") script = ExtResource("6_rli0f")
common = Array[PackedScene]([ExtResource("1_2l6sh"), ExtResource("5_jwi73")]) common = Array[PackedScene]([ExtResource("1_2l6sh")])
rare = Array[PackedScene]([ExtResource("3_g002j"), ExtResource("2_rli0f"), ExtResource("4_vpswe"), ExtResource("5_jwi73")]) rare = Array[PackedScene]([ExtResource("3_g002j"), ExtResource("2_rli0f"), ExtResource("4_vpswe"), ExtResource("5_jwi73")])
unique = Array[PackedScene]([ExtResource("6_73uum"), ExtResource("7_k6eth"), ExtResource("8_8cxou"), ExtResource("9_esvgx")]) unique = Array[PackedScene]([ExtResource("6_73uum"), ExtResource("7_k6eth"), ExtResource("8_8cxou"), ExtResource("9_esvgx")])

View file

@ -1,7 +1,6 @@
extends Item extends Item
func collect(): func collect():
player.ground_jump_strength = 1600 player.jump_strength = 1600
player.air_jump_strength = 1400
$SoundCollect.play() $SoundCollect.play()
return true return true

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=3 uid="uid://cxo6bq26huau7"] [gd_scene load_steps=16 format=3 uid="uid://cxo6bq26huau7"]
[ext_resource type="PackedScene" uid="uid://cmaovvr15b3qk" path="res://player/player.tscn" id="2_1bvp3"] [ext_resource type="PackedScene" uid="uid://cmaovvr15b3qk" path="res://player/player.tscn" id="2_1bvp3"]
[ext_resource type="Texture2D" uid="uid://d3fpq76anm4t7" path="res://world/Background Prototype/Background prototype.png" id="3_kek77"] [ext_resource type="Texture2D" uid="uid://d3fpq76anm4t7" path="res://world/Background Prototype/Background prototype.png" id="3_kek77"]
@ -15,7 +15,6 @@
[ext_resource type="PackedScene" uid="uid://cqn67nwyrtq3k" path="res://ui/journal/journal.tscn" id="10_w48qg"] [ext_resource type="PackedScene" uid="uid://cqn67nwyrtq3k" path="res://ui/journal/journal.tscn" id="10_w48qg"]
[ext_resource type="PackedScene" uid="uid://cpe4s6vsn0ujd" path="res://enemies/boss/boss.tscn" id="11_efxa6"] [ext_resource type="PackedScene" uid="uid://cpe4s6vsn0ujd" path="res://enemies/boss/boss.tscn" id="11_efxa6"]
[ext_resource type="Script" uid="uid://gul4u5tw1vxk" path="res://bg_image.gd" id="13_vivmo"] [ext_resource type="Script" uid="uid://gul4u5tw1vxk" path="res://bg_image.gd" id="13_vivmo"]
[ext_resource type="PackedScene" uid="uid://ddn025xnjngko" path="res://items/active_items/bow/bow.tscn" id="16_2cqfq"]
[node name="main" type="Node2D"] [node name="main" type="Node2D"]
@ -56,14 +55,6 @@ texture = ExtResource("4_ycdy4")
offset_right = 96.0 offset_right = 96.0
offset_bottom = 96.0 offset_bottom = 96.0
[node name="ActiveItemUses" type="VBoxContainer" parent="UIOverlay"]
unique_name_in_owner = true
offset_left = 1863.0
offset_top = 25.0
offset_right = 1895.0
offset_bottom = 120.0
alignment = 2
[node name="ItemUI" parent="UIOverlay" node_paths=PackedStringArray("player") instance=ExtResource("6_4c57u")] [node name="ItemUI" parent="UIOverlay" node_paths=PackedStringArray("player") instance=ExtResource("6_4c57u")]
player = NodePath("../../Player") player = NodePath("../../Player")
@ -104,9 +95,6 @@ colors = Array[Color]([Color(0, 0.6441987, 0.6693053, 1), Color(0.90588236, 0.15
script = ExtResource("10_efxa6") script = ExtResource("10_efxa6")
boss = ExtResource("11_efxa6") boss = ExtResource("11_efxa6")
[node name="Bow" parent="." instance=ExtResource("16_2cqfq")]
position = Vector2(325, -3068)
[connection signal="active_item_changed" from="Player" to="UIOverlay/ItemUI" method="_on_player_active_item_changed"] [connection signal="active_item_changed" from="Player" to="UIOverlay/ItemUI" method="_on_player_active_item_changed"]
[connection signal="health_changed" from="Player" to="UIOverlay/Healthbar" method="_on_player_health_changed"] [connection signal="health_changed" from="Player" to="UIOverlay/Healthbar" method="_on_player_health_changed"]
[connection signal="max_hp_changed" from="Player" to="UIOverlay/Healthbar" method="_on_player_max_hp_changed"] [connection signal="max_hp_changed" from="Player" to="UIOverlay/Healthbar" method="_on_player_max_hp_changed"]

View file

@ -19,8 +19,7 @@ var gravity = 100;
# Movement # Movement
var facing = -1; var facing = -1;
var hspeed = 150; var hspeed = 150;
var ground_jump_strength = 1400; var jump_strength = 1200;
var air_jump_strength = 1100;
var air_jumps_max = 1; var air_jumps_max = 1;
var air_jumps_current = 1; var air_jumps_current = 1;
@ -102,9 +101,9 @@ func manage_attack(delta : float):
func manage_active(_delta : float): func manage_active(_delta : float):
if(active_item != null and Input.is_action_just_pressed("item") and active_item_cooldown.is_stopped()): if(active_item != null and Input.is_action_just_pressed("item") and active_item_cooldown.is_stopped()):
active_item.trigger_activation() active_item.activate()
if(Input.is_action_just_pressed("drop_item")): if(Input.is_action_just_pressed("drop_item")):
active_item.remove() active_item = null
func manage_movement_options() -> void: func manage_movement_options() -> void:
if(is_on_floor()): if(is_on_floor()):
@ -155,10 +154,7 @@ func manage_velocity(delta: float) -> void:
dropped = true dropped = true
self.position += earth_aligner.global_from_local(Vector2(0,12)) self.position += earth_aligner.global_from_local(Vector2(0,12))
if(not dropped): if(not dropped):
if is_on_floor(): local_velocity.y = -jump_strength
local_velocity.y = -ground_jump_strength
else:
local_velocity.y = -air_jump_strength
if(local_velocity.y > max_fall_speed): if(local_velocity.y > max_fall_speed):
local_velocity.y = max_fall_speed local_velocity.y = max_fall_speed

View file

@ -27,8 +27,6 @@ func swing(dir_str) -> void:
anim_sprite.visible = true anim_sprite.visible = true
await get_tree().physics_frame await get_tree().physics_frame
await get_tree().physics_frame await get_tree().physics_frame
if dir_str == "up":
apply_swing_knockback = false
slash_timer = slash_duration slash_timer = slash_duration
func _process(delta: float) -> void: func _process(delta: float) -> void:
@ -39,7 +37,7 @@ func _process(delta: float) -> void:
for area in get_overlapping_areas(): for area in get_overlapping_areas():
var hurt_dir = -get_parent().earth_aligner.global_from_local(Vector2(-facing, 0)).rotated(facing*rotation) var hurt_dir = -get_parent().earth_aligner.global_from_local(Vector2(-facing, 0)).rotated(facing*rotation)
if area.hurt(damage, hurt_dir, dmg_id) and apply_swing_knockback: if area.hurt(damage, hurt_dir, dmg_id) and apply_swing_knockback:
get_parent().reset_to_velocity += Vector2(swing_knockback * facing, 0) get_parent().reset_to_velocity = Vector2(swing_knockback * facing, 0)
apply_swing_knockback = false apply_swing_knockback = false
else: else:
apply_swing_knockback = true apply_swing_knockback = true