Sha256: 01f404cd5499dcabb452cc418c271b4333aeb7c91d3b9d5a29c25c4be7895b56
Contents?: true
Size: 588 Bytes
Versions: 2
Compression:
Stored size: 588 Bytes
Contents
class AuthorEngine class Part module Input BUTTONS = { "left" => "ArrowLeft", "right" => "ArrowRight", "up" => "ArrowUp", "down" => "ArrowDown", "x" => "x", "y" => "c", } # Store keys state KEY_STATES = { } def button?(name) down = false if BUTTONS.dig(name) down = KEY_STATES.dig(BUTTONS.dig(name)) # dig returns false if key not found else raise "Button '#{name}' not found!" end return down end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
author_engine-0.3.1 | lib/author_engine/game/opal/parts/input.rb |
author_engine-0.3.0 | lib/author_engine/game/opal/parts/input.rb |