From 78fd742b1e276aec3eb1e939542ef51c3231b060 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Sat, 9 May 2026 16:24:51 -0700 Subject: Applies damage impulse for only frame --- dyl.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'dyl.lua') diff --git a/dyl.lua b/dyl.lua index 70325c3..8c5f8a2 100644 --- a/dyl.lua +++ b/dyl.lua @@ -56,7 +56,7 @@ function enemy() } } ) - :b_state(States.Walk) + :b_state(States.Idle) return EnemyBuilder:build() end @@ -126,16 +126,18 @@ end function sword() _particle_distance = 4 _attack_burst_sec = 0.200 - _sword_damage = { amount = 2, knockback = { magnitude = 200, time = 0.080 } } + _sword_damage = { amount = 2, knockback = { magnitude = 300, time = 0.080 } } SwordBuilder = EntityBuilder:new(World) function SwordBuilder: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) self:equip(slashing_particle(self), _particle_distance) self.damage = _sword_damage - elseif self.state == States.Slashing and self.state_stopwatch > _slashing_timer_sec then + elseif self.state == States.Slashing then self.damage = nil - self:transition_to(States.Equipped) + if (self.state_stopwatch > _slashing_timer_sec) then + self:transition_to(States.Equipped) + end end end SwordBuilder:b_type(Entities.Sword) @@ -230,7 +232,7 @@ function _init() end _step_t = time() -function _update() +function _update60() -- clear here in case we want to print to screen outside of _draw cls(0) -- cgit v1.3