added blocking doors to paths.

This commit is contained in:
2026-01-10 19:46:55 +01:00
parent 24ea2f3c60
commit 25be2c00bd
33 changed files with 4383 additions and 455 deletions

View File

@@ -102,28 +102,28 @@ func _setup_sprite():
sprite.texture = items_texture
sprite.hframes = 20
sprite.vframes = 14
sprite.frame = (8 * 20) + 11 # vframe 9, hframe 11
sprite.frame = (8 * 20) + 11
LootType.BANANA:
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
if items_texture:
sprite.texture = items_texture
sprite.hframes = 20
sprite.vframes = 14
sprite.frame = (8 * 20) + 12 # vframe 9, hframe 12
sprite.frame = (8 * 20) + 12
LootType.CHERRY:
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
if items_texture:
sprite.texture = items_texture
sprite.hframes = 20
sprite.vframes = 14
sprite.frame = (8 * 20) + 13 # vframe 9, hframe 13
sprite.frame = (8 * 20) + 13
LootType.KEY:
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
if items_texture:
sprite.texture = items_texture
sprite.hframes = 20
sprite.vframes = 14
sprite.frame = (13 * 20) + 11 # vframe 9, hframe 13
sprite.frame = (13 * 20) + 10
func _setup_collision_shape():
if not collision_shape:
@@ -338,8 +338,9 @@ func _process_pickup_on_server(player: Node):
# Give player coin
if player.has_method("add_coins"):
player.add_coins(coin_value)
# Show floating text (gold color)
_show_floating_text(player, "+1 coin", Color(1.0, 0.84, 0.0)) # Gold color
# Show floating text with item graphic and text
var coin_texture = load("res://assets/gfx/pickups/gold_coin.png")
_show_floating_text(player, "+" + str(coin_value) + " coin", Color(1.0, 0.84, 0.0), 0.5, 0.5, coin_texture, 6, 1, 0)
self.visible = false
@@ -347,14 +348,53 @@ func _process_pickup_on_server(player: Node):
if sfx_coin_collect and sfx_coin_collect.playing:
await sfx_coin_collect.finished
queue_free()
LootType.APPLE, LootType.BANANA, LootType.CHERRY:
LootType.APPLE:
if sfx_potion_collect:
sfx_potion_collect.play()
# Heal player
var actual_heal = 0.0
if player.has_method("heal"):
actual_heal = heal_amount
player.heal(heal_amount)
# Show floating text
_show_floating_text(player, "+" + str(int(heal_amount)), Color.GREEN)
# Show floating text with item graphic and heal amount
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
_show_floating_text(player, "+" + str(int(actual_heal)) + " hp", Color.GREEN, 0.5, 0.5, items_texture, 20, 14, (8 * 20) + 11)
self.visible = false
# Wait for sound to finish before removing
if sfx_potion_collect and sfx_potion_collect.playing:
await sfx_potion_collect.finished
queue_free()
LootType.BANANA:
if sfx_potion_collect:
sfx_potion_collect.play()
# Heal player
var actual_heal = 0.0
if player.has_method("heal"):
actual_heal = heal_amount
player.heal(heal_amount)
# Show floating text with item graphic and heal amount
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
_show_floating_text(player, "+" + str(int(actual_heal)) + " hp", Color.GREEN, 0.5, 0.5, items_texture, 20, 14, (8 * 20) + 12)
self.visible = false
# Wait for sound to finish before removing
if sfx_potion_collect and sfx_potion_collect.playing:
await sfx_potion_collect.finished
queue_free()
LootType.CHERRY:
if sfx_potion_collect:
sfx_potion_collect.play()
# Heal player
var actual_heal = 0.0
if player.has_method("heal"):
actual_heal = heal_amount
player.heal(heal_amount)
# Show floating text with item graphic and heal amount
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
_show_floating_text(player, "+" + str(int(actual_heal)) + " hp", Color.GREEN, 0.5, 0.5, items_texture, 20, 14, (8 * 20) + 13)
self.visible = false
@@ -365,9 +405,12 @@ func _process_pickup_on_server(player: Node):
LootType.KEY:
if sfx_key_collect:
sfx_key_collect.play()
# TODO: GIVE PLAYER KEY IN INVENTORY!
# Show floating text
_show_floating_text(player, "+1 key", Color.YELLOW)
# Give player key in inventory
if player.has_method("add_key"):
player.add_key(1)
# Show floating text with item graphic and text
var items_texture = load("res://assets/gfx/pickups/items_n_shit.png")
_show_floating_text(player, "+1 key", Color.YELLOW, 0.5, 0.5, items_texture, 20, 14, (13 * 20) + 10)
self.visible = false
@@ -458,23 +501,26 @@ func _sync_remove():
visible = false
# Wait for sound to finish before removing (if sound is playing)
var sound_playing = false
var _sound_playing = false
if loot_type == LootType.COIN and sfx_coin_collect and sfx_coin_collect.playing:
sound_playing = true
_sound_playing = true
await sfx_coin_collect.finished
elif loot_type in [LootType.APPLE, LootType.BANANA, LootType.CHERRY] and sfx_loot_collect and sfx_loot_collect.playing:
sound_playing = true
_sound_playing = true
await sfx_loot_collect.finished
# Remove from scene
if not is_queued_for_deletion():
queue_free()
func _show_floating_text(player: Node, text: String, color: Color):
# Create floating text above player
func _show_floating_text(player: Node, text: String, color: Color, show_time: float = 0.5, fade_time: float = 0.5, item_texture: Texture2D = null, sprite_hframes: int = 1, sprite_vframes: int = 1, sprite_frame: int = 0):
# Create floating text and item graphic above player's head
# Shows for show_time seconds, then fades out over fade_time seconds
var floating_text_scene = preload("res://scenes/floating_text.tscn")
if floating_text_scene:
if floating_text_scene and player and is_instance_valid(player):
var floating_text = floating_text_scene.instantiate()
player.get_parent().add_child(floating_text)
floating_text.global_position = player.global_position + Vector2(0, -20)
floating_text.setup(text, color)
var parent = player.get_parent()
if parent:
parent.add_child(floating_text)
floating_text.global_position = player.global_position + Vector2(0, -20)
floating_text.setup(text, color, show_time, fade_time, item_texture, sprite_hframes, sprite_vframes, sprite_frame)