MinecraftU / 2021-computer-adventures

Repository for our 2021 Computer Adventures Ruby project!
0 stars 0 forks source link

Control tetromino with keyboard #14

Closed dealingwith closed 3 years ago

jamespeilunli commented 3 years ago

Uh oh... the on method doesn't work either (reference)...

This code:

    def move
        on :key_down do |event|
            [code]
        end
    end

throws:

/home/jamesli/github_repos/2021-computer-adventures/tetrominos.rb:32:in `move': undefined method `on' for #<Tetromino:0x000055b4456bd678> (NoMethodError)

and previous code except with a $ before on throws:

/home/jamesli/github_repos/2021-computer-adventures/tetris.rb:3:in `require_relative': /home/jamesli/github_repos/2021-computer-adventures/tetrominos.rb:32: syntax error, unexpected ':', expecting `end' (SyntaxError)
        $on :key_down do |event|
            ^