ElixirDoom.Specials.Switches (elixir_doom v0.1.0)

Copy Markdown View Source

Switches: the texture on a used line flips to its pair, and a switch that can be used again flips back a second later. A line that works once is marked used.

step/3 is a Cauldron2D.Thinkers step for a :button, the timer that flips a switch back.

Summary

Functions

Flip the switch on line index, used by thing actor_id. repeat? starts the timer that flips it back; otherwise the line is marked used. exit? makes the exit sound.

Mark line index used, so it does nothing again, when once?.

One tic of a switch's timer; when it runs out the switch flips back.

Functions

flip(world, index, repeat?, exit?, actor_id)

Flip the switch on line index, used by thing actor_id. repeat? starts the timer that flips it back; otherwise the line is marked used. exit? makes the exit sound.

mark_used(world, index, bool)

Mark line index used, so it does nothing again, when once?.

step(button, id, world)

@spec step(map(), pos_integer(), ElixirDoom.World.t()) ::
  {:keep, map(), ElixirDoom.World.t()} | {:done, ElixirDoom.World.t()}

One tic of a switch's timer; when it runs out the switch flips back.