class GameScene

Constants

BLOCK_SIZE
HEIGHT
WIDTH

Public Class Methods

new(window, difficulty) click to toggle source
Calls superclass method Scene::new
# File lib/scene.rb, line 111
def initialize(window, difficulty)
  super(window)
  @game = Game.new(window,10, 50, HEIGHT, WIDTH, BLOCK_SIZE, difficulty)
  @ticks = 0
end

Public Instance Methods

button_down(id) click to toggle source
# File lib/scene.rb, line 121
def button_down(id)

  case id
  when Gosu::KB_ESCAPE
    @window.menu
  when Gosu::KB_LEFT
    @game.move(-1, 0)
  when Gosu::KB_RIGHT
    @game.move(1, 0)
  when Gosu::KB_UP
    @game.rotate
  when Gosu::KB_DOWN
    @game.move(0, 1)
  when Gosu::KB_SPACE
    @game.fast_move
  end
end
draw() click to toggle source
# File lib/scene.rb, line 143
def draw
  @window.font.draw_text("Score: #{@game.score}", 10, 10, ZOrder::UI, 1.0, 1.0, Gosu::Color::YELLOW)
  @window.font.draw_text("Speed: #{@game.current_difficulty}", 250, 10, ZOrder::UI, 1.0, 1.0, Gosu::Color::YELLOW)
  @game.draw(@window)
end
game_running?() click to toggle source
# File lib/scene.rb, line 139
def game_running?
  !@game.game_over
end
update() click to toggle source
# File lib/scene.rb, line 117
def update
  @game.update
end