la caméra est limité à la taille de la carte

et comme ça on arrête de voir des trucs vides autour de la boulangerie
This commit is contained in:
Thomas
2025-04-14 11:15:58 +02:00
parent be317576d5
commit bf2ed6312d
3 changed files with 20 additions and 4 deletions

View File

@@ -9,6 +9,18 @@ extends Node2D
# press grab
var can_interact_with : Node2D
@onready var cam := $"../Camera2D" as Camera2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var limits:Rect2 = world.get_used_rect()
var top_left_global = world.to_global(world.map_to_local(limits.position))
var bottom_right_global = world.to_global(world.map_to_local(limits.end))
cam.limit_left = top_left_global.x + 48
cam.limit_top = top_left_global.y - 24
cam.limit_right = bottom_right_global.x + 48
cam.limit_bottom = bottom_right_global.y - 24
func _unhandled_input(event: InputEvent) -> void:
print(human.get_feet_global_position())
human.stop_interaction()