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_layer = 0
|
||||||
collision_mask = 384
|
collision_mask = 384
|
||||||
|
|
||||||
[node name="SmallShape" type="CollisionShape2D" parent="LavaPoisonDetect"]
|
[node name="SmallShape" type="CollisionShape2D" parent="LavaPoisonDetect" groups=["SmallCollisions"]]
|
||||||
position = Vector2(0, 5.75)
|
position = Vector2(0, 5.75)
|
||||||
shape = SubResource("RectangleShape2D_uwhl4")
|
shape = SubResource("RectangleShape2D_uwhl4")
|
||||||
debug_color = Color(1, 0, 0, 0.419608)
|
debug_color = Color(1, 0, 0, 0.419608)
|
||||||
@@ -1057,6 +1057,7 @@ script = ExtResource("35_nbkfn")
|
|||||||
[node name="BigCollision" type="CollisionPolygon2D" parent="." groups=["BigCollisions"]]
|
[node name="BigCollision" type="CollisionPolygon2D" parent="." groups=["BigCollisions"]]
|
||||||
visible = false
|
visible = false
|
||||||
polygon = PackedVector2Array(-4, -2, -2, 0, 2, 0, 4, -2, 4, -23, 1, -28, -1, -28, -4, -23)
|
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")
|
script = ExtResource("35_nbkfn")
|
||||||
|
|
||||||
[node name="FootL" type="CollisionShape2D" parent="." groups=["StepCollision"]]
|
[node name="FootL" type="CollisionShape2D" parent="." groups=["StepCollision"]]
|
||||||
|
@@ -59,7 +59,10 @@ var total_keys := 0
|
|||||||
set_power_state_frame()
|
set_power_state_frame()
|
||||||
var character := "Mario"
|
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 skidding := false
|
||||||
|
|
||||||
var can_bump_sfx := true
|
var can_bump_sfx := true
|
||||||
@@ -137,6 +140,7 @@ const ANIMATION_FALLBACKS := {
|
|||||||
"Run": "Move",
|
"Run": "Move",
|
||||||
"PipeWalk": "Move",
|
"PipeWalk": "Move",
|
||||||
"LookUp": "Idle",
|
"LookUp": "Idle",
|
||||||
|
"Crouch": "Idle",
|
||||||
"CrouchFall": "Crouch",
|
"CrouchFall": "Crouch",
|
||||||
"CrouchAttack": "Attack",
|
"CrouchAttack": "Attack",
|
||||||
"FlagSlide": "Climb",
|
"FlagSlide": "Climb",
|
||||||
@@ -456,14 +460,15 @@ func handle_power_up_states(delta) -> void:
|
|||||||
var small_crouch := power_state.hitbox_size == "Small" and crouching
|
var small_crouch := power_state.hitbox_size == "Small" and crouching
|
||||||
var big_crouch := power_state.hitbox_size == "Big" and crouching
|
var big_crouch := power_state.hitbox_size == "Big" and crouching
|
||||||
for i in get_tree().get_nodes_in_group("SmallCollisions"):
|
for i in get_tree().get_nodes_in_group("SmallCollisions"):
|
||||||
if i.owner == self:
|
|
||||||
if i.name.begins_with("SmallCrouch"):
|
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:
|
else:
|
||||||
i.set_deferred("disabled", small_crouch or power_state.hitbox_size == "Big" and !crouching)
|
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"):
|
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.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
|
$Checkpoint.position.y = -20 if small_crouch else -24 if power_state.hitbox_size == "Small" or big_crouch else -40
|
||||||
power_state.update(delta)
|
power_state.update(delta)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user