From 3d1d31538d30a7f161f9f2b6d5e075ec69d3b860 Mon Sep 17 00:00:00 2001 From: iamcheeseman <[hidden email]> Date: Tue, 3 Feb 2026 22:25:00 -0500 Subject: ditch raylib (icky, and for loser BEGINNERS) --- src/player.odin | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/player.odin') diff --git a/src/player.odin b/src/player.odin index c87d2a6..5b0dd01 100644 --- a/src/player.odin +++ b/src/player.odin @@ -4,9 +4,8 @@ import "core:math" import "core:math/linalg" import "core:log" -import rl "vendor:raylib" - import "phys" +import "fw" Player_State :: enum { Default, @@ -72,10 +71,10 @@ _get_input_dir :: proc() -> f32 { input: f32 - if is_keybind_down(actions.move_left) { + if fw.is_keybind_down(actions.move_left) { input -= 1 } - if is_keybind_down(actions.move_right) { + if fw.is_keybind_down(actions.move_right) { input += 1 } @@ -92,12 +91,12 @@ _default_state :: proc(dt: f32) { set_sprite_active_tag(&player.sprite, "idle") } - if is_keybind_just_down(actions.jump) { + if fw.is_keybind_just_down(actions.jump) { player.jump_buffer = PLAYER_JUMP_BUFFERING } if player.owns_dash && - is_keybind_just_down(actions.dash) && + fw.is_keybind_just_down(actions.dash) && player.dash_cooldown <= 0 { _enter_dash() return @@ -122,9 +121,9 @@ _default_state :: proc(dt: f32) { } } - rel_mouse_pos := get_mouse_pos() - pos + rel_mouse_pos := fw.get_mouse_pos() - pos - if is_keybind_just_down(actions.shoot) { + if fw.is_keybind_just_down(actions.shoot) { mouse_dir := linalg.normalize0(rel_mouse_pos + {0, PLAYER_GUN_HEIGHT}) bullet_pos := pos @@ -157,7 +156,7 @@ _default_state :: proc(dt: f32) { } if .Down not_in collisions && - !is_keybind_down(actions.jump) && + !fw.is_keybind_down(actions.jump) && vel.y < PLAYER_JUMP_RELEASE_CUT { vel.y = PLAYER_JUMP_RELEASE_CUT } @@ -257,8 +256,8 @@ _change_rooms :: proc() { } new_cam_pos := _get_camera_target_pos() - state.camera.target += diff - state.camera_target += diff + // state.camera.target += diff + // state.camera_target += diff } } @@ -274,11 +273,8 @@ update_player :: proc(dt: f32) { update_sprite(&player.sprite, dt) - mouse_dir := linalg.normalize0(get_mouse_pos() - player.gun.sprite.pos) - player.gun.sprite.rotation = math.atan2( - mouse_dir.y, - mouse_dir.x, - ) * math.DEG_PER_RAD + mouse_dir := linalg.normalize0(fw.get_mouse_pos() - player.gun.sprite.pos) + player.gun.sprite.rotation = math.atan2(mouse_dir.y, mouse_dir.x) player.gun.sprite.pos = pos - Vec2{0, PLAYER_GUN_HEIGHT} player.gun.sprite.pos += -mouse_dir * player.gun.kickback -- cgit v1.3-2-g0d8e