diff options
Diffstat (limited to 'src/player.odin')
| -rw-r--r-- | src/player.odin | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/player.odin b/src/player.odin index 9cec035..c87d2a6 100644 --- a/src/player.odin +++ b/src/player.odin @@ -8,24 +8,6 @@ import rl "vendor:raylib" import "phys" -PLAYER_SPEED :: 100 -PLAYER_ACCEL :: 10 -PLAYER_JUMP_FORCE :: 350 -PLAYER_DOUBLE_JUMP_FORCE :: 250 -PLAYER_JUMP_BUFFERING :: 0.07 -PLAYER_COYOTE_TIME :: 0.06 -PLAYER_JUMP_RELEASE_CUT :: -100 - -PLAYER_DASH_SPEED :: 500 -PLAYER_DASH_TIME :: 0.15 -PLAYER_DASH_COOLDOWN :: 0.3 - -PLAYER_GUN_HEIGHT :: 0 -PLAYER_GUN_DIST :: 7 // how far out to hold the gun -PLAYER_GUN_KICKBACK :: 4 // how far to move the gun back when you shoot - -PLAYER_SCARF_DIST :: 5 - Player_State :: enum { Default, Dash, @@ -61,23 +43,19 @@ init_player :: proc() { player.body = body init_sprite(&player.sprite, .Player) - - player.sprite.offset = Vec2 { - math.floor(f32(player.sprite.width / 2)), - math.floor(f32(player.sprite.height / 2)), - } + set_sprite_offset_percentage(&player.sprite, {0.5, 0.5}) init_sprite(&player.gun.sprite, .Pistol) player.gun.sprite.offset = Vec2 { -PLAYER_GUN_DIST, - math.round(f32(player.gun.sprite.height / 2)), + math.round(f32(player.gun.sprite.height) * 0.5), } player.scarf = { point_max_dist = 2, point_rad = 2, - color_start = [4]f32{0.18, 0.13, 0.18, 1} * 0.5, + color_start = Color {0.18, 0.13, 0.18, 1} * 0.5, color_end = {0.18, 0.13, 0.18, 1}, } } @@ -184,10 +162,10 @@ _default_state :: proc(dt: f32) { vel.y = PLAYER_JUMP_RELEASE_CUT } - vel.x = math.lerp( + vel.x = dt_lerp( vel.x, input * PLAYER_SPEED, - math.pow(0.5, dt * PLAYER_ACCEL), + PLAYER_ACCEL, ) vel.y = math.min(vel.y + GRAVITY * dt, TERMINAL_VELOCITY) |
