From 8cd9ec2e98d27b414bc7cff3a5a98b0aad9099ce Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Thu, 14 May 2026 09:09:08 -0700 Subject: Fixes crash on equip --- dyl.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'dyl.lua') diff --git a/dyl.lua b/dyl.lua index a1174a9..e0914bd 100644 --- a/dyl.lua +++ b/dyl.lua @@ -9,7 +9,7 @@ function slashing_particle(following) :b_sprite_position(vec2(following.sprite_position)) :b_line_of_sight(vec2(following.line_of_sight)) :b_add_state( - States.Active, { + States.Equipped, { animation = { pos_y = { sequence = { 115, 116, 117 }, dt = _slashing_timer_sec / 3, reflect = vec2(true, true) }, neg_y = { sequence = { 115, 116, 117 }, dt = _slashing_timer_sec / 3 }, @@ -18,7 +18,7 @@ function slashing_particle(following) } } ) - :b_state(States.Active) + :b_state(States.Equipped) function SlashingParticleBuilder:transition_state() end @@ -167,14 +167,11 @@ function sword() } ) :b_state(States.Equipped) - return SwordBuilder:build() + e = SwordBuilder:build() + assert(e.states[States.Equipped]) + return e end -_enemy = enemy() -_sword = sword() -_wife = wife() -_bow = bow() - function player() PlayerBuilder = EntityBuilder:new(World) function PlayerBuilder:transition_state() @@ -214,10 +211,15 @@ function player() :b_state(States.Idle) return PlayerBuilder:build() end + +_enemy = enemy() +_sword = sword() +_wife = wife() +_bow = bow() _player = player() _player:equip(_sword) -_walk_speed = 35 -- powerup increase? +_walk_speed = 40 -- powerup increase? function handle_input() dpos = vec2(0, 0) if btn(0) then dpos.x -= 1 end -- cgit v1.3