diff options
Diffstat (limited to 'src/player.odin')
| -rw-r--r-- | src/player.odin | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/player.odin b/src/player.odin index debfd44..990a7d1 100644 --- a/src/player.odin +++ b/src/player.odin @@ -23,6 +23,8 @@ PLAYER_DASH_COOLDOWN :: 0.3 PLAYER_GUN_HEIGHT :: 0 PLAYER_GUN_DIST :: 5 // how far out to hold the gun +PLAYER_SCARF_DIST :: 5 + Player_State :: enum { DEFAULT, DASH, @@ -33,6 +35,7 @@ player: struct { body: phys.Body_Handle, sprite: Sprite, gun_sprite: Sprite, + scarf: Tail(7), jump_buffer: f32, coyote_time: f32, dash_cooldown: f32, @@ -66,6 +69,13 @@ init_player :: proc() { -PLAYER_GUN_DIST, math.round(f32(player.gun_sprite.height / 2)), } + + player.scarf = { + point_max_dist = 2, + point_rad = 2, + color_start = [4]f32{0.18, 0.13, 0.18, 1} * 0.5, + color_end = {0.18, 0.13, 0.18, 1}, + } } deinit_player :: proc() { @@ -294,10 +304,20 @@ update_player :: proc(dt: f32) { state.camera_target = _get_camera_target_pos() + scarf_dist: f32 = PLAYER_SCARF_DIST + if _get_input_dir() != 0 { + scarf_dist -= 1 + } + scarf_pos := linalg.round( + pos + Vec2{-scarf_dist * player.sprite.scale.x, 0}, + ) + set_tail_position(&player.scarf, scarf_pos, dt) + _change_rooms() } draw_player :: proc() { + draw_tail(player.scarf) draw_sprite(player.sprite) if player.state != .DASH { draw_sprite(player.gun_sprite) |
