fix: Camera clips through levelwalls even less
This commit is contained in:
parent
aeacd9d059
commit
f6bc1e7895
@ -55,11 +55,11 @@ func _ready():
|
||||
func _on_SignalManager_terminal_activated():
|
||||
get_node("LightAnimationPlayer").play("Pulsing")
|
||||
|
||||
func _draw():
|
||||
draw_line(Vector2((limit_left - position.x), screen_center.y), screen_left, Color(255, 0, 0), 1)
|
||||
#func _draw():
|
||||
# draw_line(Vector2((limit_left - position.x), screen_center.y), screen_left, Color(255, 0, 0), 1)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
update()
|
||||
# update()
|
||||
screen_center = (get_camera_screen_center() - position)
|
||||
screen_bottom = screen_center + Vector2(0, screen_rect.y/2)
|
||||
screen_top = screen_center - Vector2(0, screen_rect.y/2)
|
||||
@ -91,7 +91,7 @@ func _process(delta: float) -> void:
|
||||
right_move_time = max(0, right_move_time - delta)
|
||||
|
||||
_adapt_to_movement(player_vel)
|
||||
if camera_state == "centered":
|
||||
if abs(player_vel.x) <= blobby.max_velocity["walk"] * 0.9:
|
||||
_adapt_to_input(player_vel)
|
||||
position = blobby.position
|
||||
prev_pos = position
|
||||
@ -105,8 +105,9 @@ func _set_boundaries():
|
||||
# New pngs -> completely new tiles and rebuild map
|
||||
var rect = tilemap.get_used_rect()
|
||||
var cell_size = tilemap.cell_size
|
||||
limit_right = rect.end.x * cell_size.x
|
||||
limit_left = rect.position.x * cell_size.x
|
||||
# TODO +2 is fixed for camera issue in adjust horizontal
|
||||
limit_right = rect.end.x * cell_size.x - 8
|
||||
limit_left = rect.position.x * cell_size.x + 8
|
||||
limit_top = rect.position.y * cell_size.y
|
||||
limit_bottom = rect.end.y * cell_size.y
|
||||
original_limit_left = limit_left
|
||||
@ -174,17 +175,17 @@ func _adapt_to_input(velocity: Vector2) -> void:
|
||||
if(original_limit_top - position.y + 2 < screen_top.y && offset.y > -48):
|
||||
offset.y -= 1
|
||||
|
||||
# TODO This is a regulatory problem, it doesn't adapt fast enough
|
||||
# TODO Maybe just make background black and dont bother
|
||||
func _adjust_horizontal_offset(delta: float) -> void:
|
||||
if (limit_left - position.x - screen_left.x > 0.00001):
|
||||
print(limit_left - position.x - screen_left.x)
|
||||
if (limit_left - position.x - screen_left.x > 0.001):
|
||||
if (anim_player.is_playing()):
|
||||
anim_player.stop(false)
|
||||
offset.x += (limit_left - position.x - screen_left.x)/3
|
||||
if (limit_right - position.x - screen_right.x < 0.00001):
|
||||
print(limit_right - position.x - screen_right.x)
|
||||
offset.x += (limit_left - position.x - screen_left.x)/2
|
||||
if (limit_right - position.x - screen_right.x < 0.001):
|
||||
if (anim_player.is_playing()):
|
||||
anim_player.stop(false)
|
||||
offset.x += (limit_right - position.x - screen_right.x)/3
|
||||
offset.x += (limit_right - position.x - screen_right.x)/2
|
||||
|
||||
func reset_limits() -> void:
|
||||
limit_left = original_limit_left
|
||||
|
||||
@ -978,10 +978,10 @@ texture = ExtResource( 8 )
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
||||
visible = false
|
||||
frames = SubResource( 7 )
|
||||
frame = 13
|
||||
frame = 8
|
||||
playing = true
|
||||
|
||||
[node name="AnimatedSprite2" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
||||
frames = SubResource( 8 )
|
||||
frame = 4
|
||||
frame = 13
|
||||
playing = true
|
||||
|
||||
@ -44,10 +44,10 @@ unique_name_in_owner = true
|
||||
drag_margin_bottom = 0.3
|
||||
|
||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||
frame = 3
|
||||
frame = 4
|
||||
|
||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||
frame = 3
|
||||
frame = 4
|
||||
|
||||
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
||||
unique_name_in_owner = true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user