mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
fixed some weird camera shenanigans with anti-grav
This commit is contained in:
@@ -266,6 +266,8 @@ func reset_values() -> void:
|
||||
Checkpoint.passed = false
|
||||
Checkpoint.sublevel_id = 0
|
||||
Door.unlocked_doors = []
|
||||
KeyItem.total_collected = 0
|
||||
Checkpoint.keys_collected = 0
|
||||
Level.start_level_path = Level.get_scene_string(Global.world_num, Global.level_num)
|
||||
LevelPersistance.reset_states()
|
||||
Level.first_load = true
|
||||
|
@@ -24,6 +24,8 @@ var cam_direction := 1
|
||||
# how far between the center and the edge of the screen before scrolling to the center
|
||||
const SCROLL_DIFFERENCE := 48.0
|
||||
|
||||
var can_diff := true
|
||||
|
||||
func _exit_tree() -> void:
|
||||
cam_locked = false
|
||||
|
||||
@@ -84,6 +86,9 @@ func handle_horizontal_scrolling(delta: float) -> void:
|
||||
offset = camera_position.x - global_position.x - abs(true_velocity.x * delta)
|
||||
camera_position.x = global_position.x + offset
|
||||
|
||||
if can_diff == false:
|
||||
position.x = 0
|
||||
return
|
||||
# horizontal adjusgments
|
||||
# if the position is matching the camera, start scrolling towards the center
|
||||
if global_position.x >= camera_position.x:
|
||||
|
@@ -12,7 +12,7 @@ static var passed := false
|
||||
static var respawn_position := Vector2.ZERO
|
||||
static var level := ""
|
||||
static var sublevel_id := 0
|
||||
|
||||
static var keys_collected := 0
|
||||
static var old_state := [[], []]
|
||||
|
||||
func _enter_tree() -> void:
|
||||
@@ -37,6 +37,7 @@ func _ready() -> void:
|
||||
i.global_position = self.global_position
|
||||
i.reset_physics_interpolation()
|
||||
i.recenter_camera()
|
||||
KeyItem.total_collected = keys_collected
|
||||
respawned.emit()
|
||||
|
||||
|
||||
@@ -48,6 +49,7 @@ func on_area_entered(area: Area2D) -> void:
|
||||
var player: Player = area.owner
|
||||
player.passed_checkpoint()
|
||||
passed = true
|
||||
keys_collected = KeyItem.total_collected
|
||||
old_state = LevelPersistance.active_nodes.duplicate(true)
|
||||
Level.start_level_path = Global.current_level.scene_file_path
|
||||
if Global.current_game_mode == Global.GameMode.LEVEL_EDITOR or Global.current_game_mode == Global.GameMode.CUSTOM_LEVEL:
|
||||
|
@@ -28,6 +28,9 @@ func on_player_entered(player: Player) -> void:
|
||||
player.low_gravity = enable_low_gravity
|
||||
player.global_position.y -= 16
|
||||
player.global_rotation = -player.gravity_vector.angle() + deg_to_rad(90)
|
||||
player.get_node("CameraHandler").global_rotation = 0
|
||||
player.get_node("CameraHandler").position.x = 0
|
||||
player.get_node("CameraHandler").can_diff = false
|
||||
player.reset_physics_interpolation()
|
||||
|
||||
func on_player_exited(player: Player) -> void:
|
||||
@@ -36,4 +39,5 @@ func on_player_exited(player: Player) -> void:
|
||||
player.global_position.y += 16
|
||||
player.velocity.y *= 1.1
|
||||
player.global_rotation = -player.gravity_vector.angle() + deg_to_rad(90)
|
||||
player.get_node("CameraHandler").position.x = 0
|
||||
player.reset_physics_interpolation()
|
||||
|
Reference in New Issue
Block a user