This commit is contained in:
2026-08-05 16:57:44 +03:00
parent 2ac0413d78
commit da416fe5e2
27 changed files with 92 additions and 1293 deletions
+19 -3
View File
@@ -66,10 +66,10 @@ make_player :: proc(gfx: ^GraphicsAssetStore) -> Entity {
0 = GfxCircle{pos = {}, radius = 14, color = {80, 220, 100, 255}},
1 = GfxAnimatedSprite {
pos = {},
rect = {0, 0, 64, 64},
tex = gfx_get(gfx, .IDLE),
atlas = player_atlas_get(gfx, .IDLE),
frame = 0,
speed = 1,
speed = 0.5,
update = update_player_sprite,
},
}
p.hp = p.base_max_hp
@@ -78,6 +78,15 @@ make_player :: proc(gfx: ^GraphicsAssetStore) -> Entity {
return Entity{v = p}
}
update_player_sprite :: proc(g: ^GfxAnimatedSprite, dt: f32) {
g.current_time += dt
if g.current_time > g.speed {
g.current_time = g.current_time - g.speed
g.frame += 1
if g.frame > 3 do g.frame = 0
}
}
// ─── Итоговые статы из экипировки ───
player_total_dmg :: proc(p: ^Player) -> i32 {
@@ -233,4 +242,11 @@ player_update :: proc(state: ^GameState, p: ^Player, h: Handle, dt: f32) {
for &s in p.skills {
if s.timer > 0 do s.timer -= dt
}
for &gfx in p.gfx {
#partial switch &v in gfx {
case GfxAnimatedSprite:
v->update(dt)
}
}
}