9dffacd938
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).
15 lines
351 B
GDScript
15 lines
351 B
GDScript
extends Area2D
|
|
|
|
## 尖刺:碰到就把角色打回出生点。
|
|
## 碰撞掩码已经限制成只检测玩家那一层,所以进到这里的一定是玩家。
|
|
@export var damage: int = 1
|
|
|
|
|
|
func _ready() -> void:
|
|
body_entered.connect(_on_body_entered)
|
|
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
if body.has_method("hurt"):
|
|
body.hurt(damage)
|