From 246eaab6fb44e4b4ca3e2317c8c2ee2a61dbeac5 Mon Sep 17 00:00:00 2001 From: jherrflexion Date: Fri, 1 May 2026 11:55:14 -0500 Subject: [PATCH] Fix auto-platforms absorbing bombs and scaling with catcher_width Bomb coins now fall through auto-catcher platforms so only the player's catcher can detonate them. Auto-platforms also keep a fixed 60 px width regardless of the catcher_width upgrade, which was unintentionally widening every auto-platform alongside the player catcher. Co-Authored-By: Claude Opus 4.7 --- scripts/auto_platform.gd | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/scripts/auto_platform.gd b/scripts/auto_platform.gd index fd539ff..135da7a 100644 --- a/scripts/auto_platform.gd +++ b/scripts/auto_platform.gd @@ -6,11 +6,13 @@ const PLATFORM_HEIGHT: float = 14.0 const WIDTH_FRACTION: float = 0.6 const PATROL_SPEED: float = 250.0 const TINT_COLOR := Color(0.2, 0.8, 0.7, 0.6) +const COIN_SCRIPT: GDScript = preload("res://scripts/coin.gd") +const BASE_CATCHER_WIDTH: float = 100.0 # matches GameManager level-0 catcher width +const PLATFORM_WIDTH: float = BASE_CATCHER_WIDTH * WIDTH_FRACTION var floating_text_scene: PackedScene var _direction: float = 1.0 var _game_paused: bool = false -var _base_scale: Vector2 = Vector2.ONE @onready var sprite: Sprite2D = $Sprite2D @onready var collision_shape: CollisionShape2D = $CollisionShape2D @@ -24,14 +26,14 @@ func _ready() -> void: sprite.modulate = TINT_COLOR GameManager.shop_opened.connect(_on_shop_opened) GameManager.shop_closed.connect(_on_shop_closed) - GameManager.upgrade_purchased.connect(_on_upgrade_purchased) - _apply_size() + sprite.scale = Vector2(PLATFORM_WIDTH / SPRITE_NATIVE_W, PLATFORM_HEIGHT / SPRITE_NATIVE_H) + collision_shape.shape.size = Vector2(PLATFORM_WIDTH, PLATFORM_HEIGHT) func _process(delta: float) -> void: if _game_paused: return - var w: float = GameManager.get_catcher_width() * WIDTH_FRACTION + var w: float = PLATFORM_WIDTH var half_width: float = w / 2.0 var viewport_width: float = get_viewport_rect().size.x position.x += _direction * PATROL_SPEED * delta @@ -44,6 +46,8 @@ func _process(delta: float) -> void: func _on_area_entered(area: Area2D) -> void: + if area.get("coin_type") == COIN_SCRIPT.CoinType.BOMB: + return if area.has_method("collect") and not area.get("_collected"): area._collected = true var value: int = area.value @@ -66,17 +70,6 @@ func _spawn_floating_text(at_position: Vector2, value: int, coin_type: int = 0) get_parent().add_child(ft) -func _apply_size() -> void: - var w: float = GameManager.get_catcher_width() * WIDTH_FRACTION - _base_scale = Vector2(w / SPRITE_NATIVE_W, PLATFORM_HEIGHT / SPRITE_NATIVE_H) - sprite.scale = _base_scale - collision_shape.shape.size = Vector2(w, PLATFORM_HEIGHT) - - -func _on_upgrade_purchased(_id: String) -> void: - _apply_size() - - func _on_shop_opened() -> void: _game_paused = true monitoring = false