From 42aeb43e2c8a959f5ea1f9a33cfe63d667321c56 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Sun, 26 Apr 2026 16:52:37 -0700 Subject: Very naive knockback --- dyl.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'dyl.lua') diff --git a/dyl.lua b/dyl.lua index e379ae3..bd024ef 100644 --- a/dyl.lua +++ b/dyl.lua @@ -31,6 +31,7 @@ enemy = entity() function enemy:transition_state() end enemy:b_type(Entities.Enemy) + :b_health(100) :b_position(vec2(30, 40)) :b_sprite_position(vec2(30, 30)) :b_line_of_sight(vec2(1, 0)) @@ -100,16 +101,18 @@ bow:b_type(Entities.Bow) sword = entity() _attack_burst_sec = 0.200 +_sword_damage = { amount = 2, knockback = { magnitude = 200, time = 0.080 } } function sword:transition_state() if button_just_pressed(5) and self.state == States.Equipped and self.state_stopwatch > _attack_burst_sec then self:transition_to(States.Slashing) spawn_slashing_particle(self) + self.damage = _sword_damage elseif self.state == States.Slashing and self.state_stopwatch > _slashing_timer_sec then + self.damage = nil self:transition_to(States.Equipped) end end -sword - :b_type(Entities.Sword) +sword:b_type(Entities.Sword) :b_line_of_sight(vec2(1, 0)) :b_position(vec2(0, 0)) :b_sprite_position(vec2(0, 0)) -- cgit v1.3