mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
Added if check for pirahna plant offsets to slightly optimize it
This commit is contained in:
@@ -194,6 +194,8 @@ func _process(_delta: float) -> void:
|
|||||||
const OFFSETS = [Vector2.ZERO, Vector2(0, -16), Vector2(-16, 0), Vector2.ZERO]
|
const OFFSETS = [Vector2.ZERO, Vector2(0, -16), Vector2(-16, 0), Vector2.ZERO]
|
||||||
if Global.level_editor != null:
|
if Global.level_editor != null:
|
||||||
owner.global_rotation_degrees = [0, 180, 90, -90][owner.plant_direction]
|
owner.global_rotation_degrees = [0, 180, 90, -90][owner.plant_direction]
|
||||||
|
# guzlad: only do the offset calculations if the directions actually need them, stops wasting time for other directions
|
||||||
|
if (owner.plant_direction == 1 or owner.plant_direction == 2):
|
||||||
var offset = OFFSETS[owner.plant_direction]
|
var offset = OFFSETS[owner.plant_direction]
|
||||||
owner.global_position = Vector2((owner.get_meta(\"tile_position\") + Vector2i(1, 1)) * 16) + offset
|
owner.global_position = Vector2((owner.get_meta(\"tile_position\") + Vector2i(1, 1)) * 16) + offset
|
||||||
"
|
"
|
||||||
|
Reference in New Issue
Block a user