class PlayState
class PlayState
Public Class Methods
new(two_players = false)
click to toggle source
# File lib/gamestates/play_state.rb, line 5 def initialize(two_players = false) @game_over = Gosu::Image.from_text($window, "Game\nover", $window.mediamanager.font, 40) @map = Map.new(two_players, 1) @upgrade_prob = 0.0001 end
Public Instance Methods
draw()
click to toggle source
# File lib/gamestates/play_state.rb, line 26 def draw @game_over.draw($window.width / 2 - @game_over.width / 2, $window.height / 2 - @game_over.height / 2 - 10, 11, 1, 1, 0xffff0000) if @map.game_over? @map.draw end
update(keymap)
click to toggle source
# File lib/gamestates/play_state.rb, line 15 def update(keymap) return if @map.game_over? if rand < @upgrade_prob @map.upgrade_create @upgrade_prob = 0.0001 else @upgrade_prob += 0.00001 if @map.upgrades_size == 0 end @map.update(keymap) end