mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
Refactored Small Crouching and Big Crouching
- Added new variables to `CharacterInfo.json` - Made it so `BlockCollision` area position is attached to top of `SmallCollision` and `BigCollision`
This commit is contained in:
@@ -3,10 +3,16 @@ extends CollisionPolygon2D
|
||||
|
||||
@export var offset := Vector2.ZERO
|
||||
@export var height := 0.0
|
||||
@export var hitbox := Vector3.ONE
|
||||
|
||||
var crouching := false
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
scale = Vector2(hitbox.x, hitbox.y)
|
||||
if crouching and get_meta("scalable", true): scale.y *= hitbox.z
|
||||
update()
|
||||
|
||||
func update() -> void:
|
||||
var height_to_use = height
|
||||
position.y = -height_to_use / 2 * scale.y - offset.y
|
||||
if get_meta("scalable", true):
|
||||
position.y = -height_to_use / 2 * scale.y - offset.y
|
||||
|
@@ -2,16 +2,19 @@
|
||||
extends CollisionShape2D
|
||||
|
||||
@export var offset := Vector2.ZERO
|
||||
@export var link: Node2D
|
||||
@export var link: CollisionPolygon2D
|
||||
@export var hitbox := Vector3.ONE
|
||||
|
||||
func _ready() -> void:
|
||||
set_process(Engine.is_editor_hint())
|
||||
var crouching := false
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
func _physics_process(_delta: float) -> void:
|
||||
scale = Vector2(hitbox.x, hitbox.y)
|
||||
if crouching and get_meta("scalable", true): scale.y *= hitbox.z
|
||||
update()
|
||||
|
||||
func update() -> void:
|
||||
var height_to_use = shape.size.y
|
||||
if link != null:
|
||||
height_to_use *= link.scale.y * link.scale.y
|
||||
position.y = -height_to_use / 2 * scale.y - offset.y
|
||||
if get_meta("scalable", true):
|
||||
position.y = -height_to_use / 2 * scale.y - offset.y
|
||||
|
Reference in New Issue
Block a user