rendering fixes and menu

This commit is contained in:
2025-10-15 00:18:23 +02:00
parent ea63279633
commit 283e3cbb5a
21 changed files with 338 additions and 65 deletions

View File

@@ -1,6 +1,6 @@
extends CharacterBody2D
const SPEED: int = 500
const SPEED: int = 800
@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var cam: Camera2D = $Camera2D
@@ -17,19 +17,20 @@ func _ready() -> void:
cam.limit_right = used_tilemap_rect.end.x * tilesize
cam.limit_bottom = used_tilemap_rect.end.y * tilesize
var x_margin: float = float(tilesize) / 4
var y_margin: float = float(tilesize) / 2
var margin: float = float(tilesize) / 4
position_limit_rect = Rect2(
Vector2(cam.limit_left + x_margin, cam.limit_top + y_margin),
Vector2(cam.limit_left + margin, cam.limit_top - margin),
Vector2(
(cam.limit_right - x_margin) - (cam.limit_left + x_margin),
(cam.limit_bottom - y_margin) - (cam.limit_top + y_margin)
(cam.limit_right - margin) - (cam.limit_left + margin),
(cam.limit_bottom - margin / 2) - (cam.limit_top + margin / 2)
)
)
func _physics_process(delta: float) -> void:
velocity = Input.get_vector("move_left","move_right","move_up","move_down").normalized() * delta * SPEED * 3
if EventManager.player_free:
velocity = Input.get_vector("move_left","move_right","move_up","move_down").normalized() * delta * SPEED * 3
move_and_slide()
position = position.clamp(position_limit_rect.position, position_limit_rect.end)
@@ -45,4 +46,3 @@ func _physics_process(delta: float) -> void:
animated_sprite.animation = "down"
else:
animated_sprite.stop()