Compare commits

..

2 Commits

Author SHA1 Message Date
WiseNoodle
678c14b680 Add player sprint and anim change while sprinting 2026-02-15 22:16:16 -05:00
7f7cbc567b Set config flagsset config flags 2026-02-15 20:59:04 -06:00
2 changed files with 24 additions and 4 deletions

View File

@@ -10,6 +10,9 @@ tilemap_sheet: TilemapSpritesheet
main :: proc() { main :: proc() {
fmt.println("Brackey's Game Jam 2026 :) ") fmt.println("Brackey's Game Jam 2026 :) ")
config_flags: raylib.ConfigFlags = {.WINDOW_RESIZABLE}
raylib.SetConfigFlags(config_flags)
raylib.InitWindow(1920, 1080, "Game") raylib.InitWindow(1920, 1080, "Game")
raylib.SetTargetFPS(60) raylib.SetTargetFPS(60)
@@ -18,10 +21,10 @@ main :: proc() {
TILEMAP_TILE_SIZE, TILEMAP_TILE_SIZE,
TILEMAP_TILE_SIZE, TILEMAP_TILE_SIZE,
) )
grid = create_tile_grid(100, 100) grid = create_tile_grid(300, 300)
player = { player = {
position = {0, 0}, position = {20, 20},
camera = { camera = {
zoom = 4, zoom = 4,
offset = {f32(raylib.GetScreenWidth()) / 2, f32(raylib.GetScreenHeight()) / 2}, offset = {f32(raylib.GetScreenWidth()) / 2, f32(raylib.GetScreenHeight()) / 2},

View File

@@ -4,7 +4,8 @@ import "core:fmt"
import "core:strings" import "core:strings"
import "vendor:raylib" import "vendor:raylib"
PLAYER_SPEED :: 2 PLAYER_SPRINT_SPEED :: 2.5
PLAYER_SPEED :: 1.5
PLAYER_WIDTH :: 32 PLAYER_WIDTH :: 32
PLAYER_HEIGHT :: 32 PLAYER_HEIGHT :: 32
PLAYER_SPRITE_PATH :: "assets/player/player.png" PLAYER_SPRITE_PATH :: "assets/player/player.png"
@@ -58,8 +59,24 @@ handle_player_input :: proc(p: ^Player, delta: f32) {
is_moving := dir.x != 0 || dir.y != 0 is_moving := dir.x != 0 || dir.y != 0
if (is_moving) { if (is_moving) {
is_sprinting:= false
if raylib.IsKeyDown(.LEFT_SHIFT) {
is_sprinting = true
} else {
is_sprinting = false
}
dir = raylib.Vector2Normalize(dir) dir = raylib.Vector2Normalize(dir)
dir = dir * PLAYER_SPEED
if is_sprinting{
dir = dir * PLAYER_SPRINT_SPEED
p.animator.anim.fps = 11
} else {
dir = dir * PLAYER_SPEED
p.animator.anim.fps = 6
}
p.position = p.position + dir p.position = p.position + dir
if dir.x < 0 { if dir.x < 0 {