Class: GameWindow

Inherits:
Chingu::Window
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/gui/gosu/chinguroids/chinguroids.rb

Overview

GameWindow Class

Instance Method Summary collapse

Constructor Details

#initializeGameWindow

initialize



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/chinguroids.rb', line 33

def initialize
  super(800,600,false)
  $intro = true     # start out by defining some constants used later in the game
  $max_x = 815
  $max_y = 615
  $scr_edge = 15
  $cooling_down = 70
  $star_grab = Sound["media/audio/star_pickup.ogg"]
  $power_up  = Sound["media/audio/power_up.ogg"]
  self.caption = 'ChinguRoids'
  @cursor = true # false hides cursor
  self.input = {
    :esc => :exit,  # global controls
    [:q, :l] => :pop,
     :z => :log,
     :r => lambda{current_game_state.setup}
  }
  retrofy   # use retrofy for improved scaling of images
end

Instance Method Details

#logObject

log

pressing ā€˜zā€™ at any time returns name of current gamestate.



61
62
63
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/chinguroids.rb', line 61

def log
  puts $window.current_game_state
end

#popObject

pop



66
67
68
69
70
71
72
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/chinguroids.rb', line 66

def pop  # pressing 'q' or 'l' at any time backs out of current gamestate
  if $window.current_game_state.to_s == "Introduction" or $window.current_game_state.to_s == "Level_1" then
    pop_game_state(setup: true)
  elsif $window.current_game_state.to_s != "OpeningCredits"
    pop_game_state(setup: false)
  end
end

#setupObject

setup



54
55
56
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/chinguroids.rb', line 54

def setup
  push_game_state(Beginning) # start by pushing Beginning gamestate
end