Files
sijcdu 9dffacd938 Initial commit: Godot 4.7 pixel platformer prototype
Player: move/jump (Space), test flight (F, debug builds only). Key: pickup, hold S to aim with live trajectory preview, release to throw, W to warp to the thrown key. Spring bounce. Spikes deal damage. 3-heart health, Z consumes a heal item for +1 heart and a 5s shield. HUD with hearts and item count. Death screen with fade-to-black and restart. Hidden passages. Assets: Kenney Pixel Platformer (CC0).
2026-10-07 20:32:42 +08:00

15 lines
361 B
GDScript

extends Area2D
## 走到就捡走,给玩家增加一次"回血道具"。
## 碰撞掩码已经限制成只检测玩家那一层,所以进到这里的一定是玩家。
func _ready() -> void:
body_entered.connect(_on_body_entered)
func _on_body_entered(body: Node2D) -> void:
if body.has_method("add_heal_item"):
body.add_heal_item()
queue_free()