mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
Properly implement the Hammer item (#599)
* Properly implement the Hammer item * Update Boo.gd * Update LongFirebar.tscn
This commit is contained in:

committed by
GitHub

parent
651988bf5e
commit
8474bc3c19
@@ -8,18 +8,26 @@ extends Node
|
||||
signal player_hit(player: Player)
|
||||
signal player_stomped_on(player: Player)
|
||||
signal invincible_player_hit(player: Player)
|
||||
signal hammer_player_hit(player: Player)
|
||||
|
||||
func _ready() -> void:
|
||||
hitbox.area_entered.connect(area_entered)
|
||||
|
||||
func area_entered(area: Area2D) -> void:
|
||||
if area.owner is Player:
|
||||
player_entered(area.owner)
|
||||
if area.name == "HammerHitbox":
|
||||
hammer_entered(area.owner)
|
||||
else:
|
||||
player_entered(area.owner)
|
||||
|
||||
func player_entered(player: Player) -> void:
|
||||
if player.is_invincible or player.has_hammer:
|
||||
if player.is_invincible:
|
||||
invincible_player_hit.emit(player)
|
||||
elif (player.velocity.y >= 15 or (player.global_position.y + height < owner.global_position.y)) and player.in_water == false:
|
||||
player_stomped_on.emit(player)
|
||||
else:
|
||||
player_hit.emit(player)
|
||||
|
||||
func hammer_entered(player: Player) -> void:
|
||||
if player.has_hammer:
|
||||
hammer_player_hit.emit(player)
|
||||
|
Reference in New Issue
Block a user