diff --git a/src/game_entity_player.odin b/src/game_entity_player.odin deleted file mode 100644 index 850cbc2..0000000 --- a/src/game_entity_player.odin +++ /dev/null @@ -1,41 +0,0 @@ -package game - -import "core:math" -import rl "vendor:raylib" - -init_player :: proc() -> Entity { - return Entity{ - type = .Player, - active = true, - pos = rl.Vector2{0,0}, - speed = 900, - shape = .Rectangle, - shape_size = rl.Vector2{50, 250} - } -} - -update_player :: proc(dt: f32, player: ^Entity, level: ^Level) { - bounds : rl.Rectangle = level.field_bounds - - // 1. Gather Directional Input - move_dir: f32 = 0 - if rl.IsKeyDown(.W) || rl.IsKeyDown(.UP) { - move_dir -= 1.0 - } - if rl.IsKeyDown(.S) || rl.IsKeyDown(.DOWN) { - move_dir += 1.0 - } - - // 2. Apply Movement (Frame-rate independent) - player.pos.y += move_dir * player.speed * dt - - // 3. Clamp Position within Field Bounds - min_y := bounds.y + 3 // Padding offset inside border - max_y := bounds.y + bounds.height - player.shape_size.y - 3 - - player.pos.y = math.clamp(player.pos.y, min_y, max_y) -} - -render_player :: proc(player: Entity, field_bounds: rl.Rectangle) { - rl.DrawRectangleV(player.pos, player.shape_size, rl.BLACK) -} \ No newline at end of file