3d
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package main
|
||||
|
||||
import rl "vendor:raylib"
|
||||
|
||||
// Навыки: Q — рывок, W — спин (AoE), E — хил
|
||||
cast_skill :: proc(state: ^GameState, p: ^Player, kind: SkillKind) {
|
||||
slot := skill_slot(p, kind)
|
||||
if slot == -1 do return
|
||||
s := &p.skills[slot]
|
||||
if s.timer > 0 do return
|
||||
s.timer = s.cd
|
||||
|
||||
switch kind {
|
||||
case .Dash:
|
||||
p.dash_timer = 0.2
|
||||
p.vel = p.aim * 750
|
||||
p.invuln_timer = 0.25
|
||||
case .Spin:
|
||||
init_attack(state, Attack{
|
||||
parent = state.player,
|
||||
dir = {1, 0},
|
||||
dmg = player_total_dmg(p) * 2,
|
||||
crit = player_crit(p),
|
||||
radius = p.attack_range * 1.2,
|
||||
arc = 6.28,
|
||||
lifetime = 0.4,
|
||||
color = {255, 200, 60, 80},
|
||||
})
|
||||
case .Heal:
|
||||
p.hp = min(p.hp + player_max_hp(p) / 3, player_max_hp(p))
|
||||
init_fx(state, FX{
|
||||
parent = state.player,
|
||||
lifetime = 0.5,
|
||||
base = BaseEntity{gfx = {0 = GfxCircle{pos = {}, radius = 20, color = {80, 255, 120, 50}}}},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
skill_slot :: proc(p: ^Player, kind: SkillKind) -> int {
|
||||
for i in 0 ..< SKILL_COUNT {
|
||||
if p.skills[i].kind == kind do return i
|
||||
}
|
||||
return -1
|
||||
}
|
||||
Reference in New Issue
Block a user