diff options
| author | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-05-14 09:09:08 -0700 |
|---|---|---|
| committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-05-14 09:09:08 -0700 |
| commit | 8cd9ec2e98d27b414bc7cff3a5a98b0aad9099ce (patch) | |
| tree | 07d56ae38d4131e571932322b3c5061d12bbd8d6 /dyl.lua | |
| parent | e51b2ab9998588d2c4c842d861806c81011d751b (diff) | |
| download | dyl8-8cd9ec2e98d27b414bc7cff3a5a98b0aad9099ce.tar.gz dyl8-8cd9ec2e98d27b414bc7cff3a5a98b0aad9099ce.zip | |
Fixes crash on equip
Diffstat (limited to 'dyl.lua')
| -rw-r--r-- | dyl.lua | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -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 |
