mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 23:48:11 +00:00
Update hitboxes for consistency (#608)
Co-authored-by: Joe H <97353363+JHDev2006@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
ed297891fd
commit
9a17f140e0
@@ -1,7 +1,8 @@
|
||||
extends PowerUpItem
|
||||
|
||||
func collect_item(_player: Player) -> void:
|
||||
AudioManager.play_sfx("clock_get", global_position)
|
||||
$Label/AnimationPlayer.play("Appear")
|
||||
Global.time = clamp(Global.time + 100, 0, 999)
|
||||
Global.score += 1000
|
||||
func on_area_entered(area: Area2D) -> void:
|
||||
if area.owner is Player:
|
||||
AudioManager.play_sfx("clock_get", global_position)
|
||||
$Label/AnimationPlayer.play("Appear")
|
||||
Global.time = clamp(Global.time + 100, 0, 999)
|
||||
Global.score += 1000
|
||||
|
@@ -1,4 +1,8 @@
|
||||
extends PowerUpItem
|
||||
|
||||
func play_sfx() -> void:
|
||||
AudioManager.play_sfx("hachisuke", global_position)
|
||||
func on_area_entered(area: Area2D) -> void:
|
||||
if area.owner is Player:
|
||||
AudioManager.play_sfx("hachisuke", global_position)
|
||||
Global.score += 8000
|
||||
$ScoreNoteSpawner.spawn_note(8000)
|
||||
queue_free()
|
||||
|
@@ -1,11 +1,8 @@
|
||||
class_name Hammer
|
||||
extends Node2D
|
||||
|
||||
var velocity := Vector2(0, -200)
|
||||
|
||||
var direction := -1
|
||||
extends Enemy
|
||||
|
||||
func _ready() -> void:
|
||||
velocity = Vector2(0, -200)
|
||||
$Sprite.flip_h = direction == 1
|
||||
$Animations.speed_scale = -direction
|
||||
velocity.x = 120 * direction
|
||||
@@ -16,10 +13,3 @@ func _physics_process(delta: float) -> void:
|
||||
global_position += velocity * delta
|
||||
velocity.y += (Global.entity_gravity / delta) * delta
|
||||
velocity.y = clamp(velocity.y, -INF, Global.entity_max_fall_speed)
|
||||
|
||||
func flag_die() -> void:
|
||||
queue_free()
|
||||
|
||||
func on_area_entered(area: Area2D) -> void:
|
||||
if area.owner is Player and area.name != "HammerHitbox":
|
||||
area.owner.damage()
|
||||
|
@@ -1,8 +1,6 @@
|
||||
extends PowerUpItem
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func on_player_entered(player: Player) -> void:
|
||||
player.hammer_get()
|
||||
queue_free()
|
||||
func on_area_entered(area: Area2D) -> void:
|
||||
if area.owner is Player:
|
||||
area.owner.hammer_get()
|
||||
queue_free()
|
||||
|
@@ -6,11 +6,12 @@ const SMOKE_PARTICLE = preload("uid://d08nv4qtfouv1")
|
||||
func _ready() -> void:
|
||||
$AnimationPlayer.play("Float")
|
||||
|
||||
func collected() -> void:
|
||||
total_collected += 1
|
||||
AudioManager.play_sfx("key_collect", global_position)
|
||||
summon_smoke_particle()
|
||||
queue_free()
|
||||
func on_area_entered(area: Area2D) -> void:
|
||||
if area.owner is Player:
|
||||
total_collected += 1
|
||||
AudioManager.play_sfx("key_collect", global_position)
|
||||
summon_smoke_particle()
|
||||
queue_free()
|
||||
|
||||
func summon_smoke_particle() -> void:
|
||||
var node = SMOKE_PARTICLE.instantiate()
|
||||
|
@@ -14,8 +14,9 @@ func _ready() -> void:
|
||||
$Sprite.play("Collected")
|
||||
set_visibility_layer_bit(0, false)
|
||||
|
||||
func on_player_entered(_player: Player) -> void:
|
||||
collected()
|
||||
func on_area_entered(area: Area2D) -> void:
|
||||
if area.owner is Player:
|
||||
collected()
|
||||
|
||||
func collected() -> void:
|
||||
if already_collected:
|
||||
|
@@ -72,6 +72,6 @@ func on_player_entered(_player: Player) -> void:
|
||||
|
||||
|
||||
func on_area_exited(area: Area2D) -> void:
|
||||
if area.owner is Player:
|
||||
if area.owner is Player and area.name != "HammerHitbox":
|
||||
if area.owner.state_machine.state.name == "Climb":
|
||||
area.owner.state_machine.transition_to("Normal")
|
||||
|
Reference in New Issue
Block a user