Class: GamesAndRpgParadise::GUI::Memory::Game

Inherits:
Gosu::Window
  • Object
show all
Includes:
Memory
Defined in:
lib/games_and_rpg_paradise/gui/gosu/memory/game.rb

Constant Summary collapse

PROJECT_BASE_DIRECTORY =
#

PROJECT_BASE_DIRECTORY

#
::GamesAndRpgParadise.project_base_directory?

Constants included from Memory

Memory::ARRAY_IMAGES_FOR_THE_MEMORY_GAME, Memory::FILE_BLACK_BACKGROUND, Memory::FILE_CAMEL_HEAD, Memory::FILE_CARD_RANDOM, Memory::FILE_DONKEY, Memory::FILE_FROG, Memory::FILE_LION, Memory::FILE_NEW_GAME, Memory::FILE_OCTOPUS, Memory::FILE_SAD_CRAB, Memory::FILE_SHEEP, Memory::FILE_SNAIL, Memory::FILE_SPERM_WHALE, Memory::FILE_UNICORN, Memory::GAME_MESSAGE_YOU_WON, Memory::IMAGES_DIRECTORY, Memory::SCREENHEIGHT, Memory::SCREENWIDTH, Memory::TITLE, Memory::USE_THIS_FONT_FAMILY

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Gosu::Window

#gosu_button_down?, #image, #image10?, #image1?, #image2?, #image3?, #image4?, #image5?, #image6?, #image7?, #image8?, #image9?, #on_left_arrow_pressed?, #on_right_arrow_pressed?, #q_means_quit, #set_font, #set_title, #sqrt, #tab_key?, #write_this_text

Constructor Details

#initialize(run_already = true) ⇒ Game

#

initialize

#


35
36
37
38
39
40
41
42
43
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 35

def initialize(
    run_already = true
  )
  super(SCREENWIDTH, SCREENHEIGHT, {fullscreen: false})
  set_title(TITLE)
  reset
  load_images
  run if run_already
end

Class Method Details

.fontsObject

#

Game.fonts

#


90
91
92
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 90

def self.fonts
  GOSU_USE_THIS_FONT
end

Instance Method Details

#best_time=(i) ⇒ Object

#

best_time=

#


113
114
115
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 113

def best_time=(i)
  @best_time = i
end

#best_time?Boolean Also known as: best_time

#

best_time?

#

Returns:

  • (Boolean)


120
121
122
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 120

def best_time?
  @best_time
end

#button_down(id) ⇒ Object

#

button_down

#


127
128
129
130
131
132
133
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 127

def button_down(id)
  case id
  when Gosu::KbEscape # On escape-button.
    $w.close # Close the game-window.
  end
  ::GamesAndRpgParadise::GUI::Memory.current_game.button_down(id)
end

#button_up(id) ⇒ Object

#

button_up

#


76
77
78
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 76

def button_up(id)
  ::GamesAndRpgParadise::GUI::Memory.current_game.button_up(id)
end

#drawObject

#

draw (draw tag)

#


59
60
61
62
63
64
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 59

def draw
  GOSU_USE_THIS_FONT.draw_text('TIME', 380, 10, 1)
  GOSU_USE_THIS_FONT.draw_text('BEST', 380, 80, 1)
  GOSU_USE_THIS_FONT.draw_text(@best_time, 380, 100, 1)
  ::GamesAndRpgParadise::GUI::Memory.current_game.draw
end

#images?Boolean Also known as: images

#

images?

#

Returns:

  • (Boolean)


83
84
85
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 83

def images?
  ::GamesAndRpgParadise::GUI::Memory.available_images?
end

#load_imagesObject

#

load_images

This method will load up the available animals.

#


106
107
108
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 106

def load_images
  ::GamesAndRpgParadise::GUI::Memory.load_images
end

#needs_cursor?Boolean

#

needs_cursor?

#

Returns:

  • (Boolean)


97
98
99
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 97

def needs_cursor?
  true
end

#resetObject

#

reset

#


48
49
50
51
52
53
54
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 48

def reset
  # ======================================================================= #
  # === @best_time
  # ======================================================================= #
  @best_time = 1000
  ::GamesAndRpgParadise::GUI::Memory.current_game = PlayGame.new
end

#runObject

#

run

#


138
139
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 138

def run
end

#updateObject

#

update

#


69
70
71
# File 'lib/games_and_rpg_paradise/gui/gosu/memory/game.rb', line 69

def update
  ::GamesAndRpgParadise::GUI::Memory.current_game.update
end