Compare commits
2 Commits
aaf04c9e1a
...
678c14b680
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
678c14b680 | ||
| 7f7cbc567b |
@@ -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},
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user