mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
Prevents small crouch if it's not a used animation
Also added some functions for debugging and toggling visible collisions. Also fixed some inconsistencies with both small and big collisions.
This commit is contained in:
@@ -711,7 +711,7 @@ position = Vector2(0, -13)
|
||||
collision_layer = 0
|
||||
collision_mask = 384
|
||||
|
||||
[node name="SmallShape" type="CollisionShape2D" parent="LavaPoisonDetect"]
|
||||
[node name="SmallShape" type="CollisionShape2D" parent="LavaPoisonDetect" groups=["SmallCollisions"]]
|
||||
position = Vector2(0, 5.75)
|
||||
shape = SubResource("RectangleShape2D_uwhl4")
|
||||
debug_color = Color(1, 0, 0, 0.419608)
|
||||
@@ -1057,6 +1057,7 @@ script = ExtResource("35_nbkfn")
|
||||
[node name="BigCollision" type="CollisionPolygon2D" parent="." groups=["BigCollisions"]]
|
||||
visible = false
|
||||
polygon = PackedVector2Array(-4, -2, -2, 0, 2, 0, 4, -2, 4, -23, 1, -28, -1, -28, -4, -23)
|
||||
one_way_collision = true
|
||||
script = ExtResource("35_nbkfn")
|
||||
|
||||
[node name="FootL" type="CollisionShape2D" parent="." groups=["StepCollision"]]
|
||||
|
@@ -59,7 +59,10 @@ var total_keys := 0
|
||||
set_power_state_frame()
|
||||
var character := "Mario"
|
||||
|
||||
var crouching := false
|
||||
var crouching := false:
|
||||
get(): # You can't crouch if the animation somehow doesn't exist.
|
||||
if not sprite.sprite_frames.has_animation("Crouch"): return false
|
||||
return crouching
|
||||
var skidding := false
|
||||
|
||||
var can_bump_sfx := true
|
||||
@@ -137,6 +140,7 @@ const ANIMATION_FALLBACKS := {
|
||||
"Run": "Move",
|
||||
"PipeWalk": "Move",
|
||||
"LookUp": "Idle",
|
||||
"Crouch": "Idle",
|
||||
"CrouchFall": "Crouch",
|
||||
"CrouchAttack": "Attack",
|
||||
"FlagSlide": "Climb",
|
||||
@@ -456,14 +460,15 @@ func handle_power_up_states(delta) -> void:
|
||||
var small_crouch := power_state.hitbox_size == "Small" and crouching
|
||||
var big_crouch := power_state.hitbox_size == "Big" and crouching
|
||||
for i in get_tree().get_nodes_in_group("SmallCollisions"):
|
||||
if i.owner == self:
|
||||
if i.name.begins_with("SmallCrouch"):
|
||||
i.set_deferred("disabled", power_state.hitbox_size == "Small" and !crouching)
|
||||
i.set_deferred("disabled", power_state.hitbox_size == "Small" and !crouching or power_state.hitbox_size == "Big")
|
||||
i.visible = not i.disabled
|
||||
else:
|
||||
i.set_deferred("disabled", small_crouch or power_state.hitbox_size == "Big" and !crouching)
|
||||
i.visible = not i.disabled
|
||||
for i in get_tree().get_nodes_in_group("BigCollisions"):
|
||||
if i.owner == self:
|
||||
i.set_deferred("disabled", power_state.hitbox_size == "Small" or big_crouch)
|
||||
i.visible = not i.disabled
|
||||
$Checkpoint.position.y = -20 if small_crouch else -24 if power_state.hitbox_size == "Small" or big_crouch else -40
|
||||
power_state.update(delta)
|
||||
|
||||
|
Reference in New Issue
Block a user