Class: GamePlay::MiningGame

Inherits:
BaseCleanUpdate::FrameBalanced show all
Includes:
UI::MiningGame
Defined in:
scripts/01450 Systems/08001 Mining Game/00040 GamePlay_Mining_Game/00001 MiningGame_Initialize.rb,
scripts/01450 Systems/08001 Mining Game/00040 GamePlay_Mining_Game/00005 MiningGame_Logic.rb,
scripts/01450 Systems/08001 Mining Game/00040 GamePlay_Mining_Game/00006 MiningGame_Mouse.rb,
scripts/01450 Systems/08001 Mining Game/00040 GamePlay_Mining_Game/00003 MiningGame_Actions.rb,
scripts/01450 Systems/08001 Mining Game/00040 GamePlay_Mining_Game/00002 MiningGame_Graphics.rb,
scripts/01450 Systems/08001 Mining Game/00040 GamePlay_Mining_Game/00004 MiningGame_Animations.rb

Overview

Class that describes the functionment of the scene

Constant Summary collapse

DATA =

Constant that stock the Database of the Mining Game

GameData::MiningGame::DATA_ITEM
DEFAULT_MUSIC =

The base music of the scene

'audio/bgm/mining_game'
NB_X_TILES =

The number of tiles per lines in the table

16
NB_Y_TILES =

The number of tiles per columns in the table

13
FIRST_TIME_TEXT =

IDs of the text displayed when playing for the first time

[[9005, 6], [9005, 7], [9005, 8], [9005, 10], [9005, 11], [9005, 12]]
FIRST_TIME_TEXT_ALTERNATIVE =

IDs of the text displayed when playing for the first time (dynamite mode)

[9005, 9]
TOOLS =

List of the usable tools

%i[pickaxe mace dynamite]
SE_PATH =

Pathname of the SE folder

'audio/se/mining_game'

Constants inherited from BaseCleanUpdate

BaseCleanUpdate::AIU_KEY2METHOD

Constants inherited from Base

Base::DEFAULT_TRANSITION, Base::DEFAULT_TRANSITION_PARAMETER

Constants included from Input

Input::ALIAS_KEYS, Input::AXIS_MAPPING, Input::AXIS_SENSITIVITY, Input::DEAD_ZONE, Input::Keyboard, Input::Keys, Input::NON_TRIGGER_ZONE, Input::REPEAT_COOLDOWN, Input::REPEAT_SPACE

Constants included from DisplayMessage

DisplayMessage::MESSAGE_ERROR, DisplayMessage::MESSAGE_PROCESS_ERROR

Instance Attribute Summary collapse

Attributes inherited from Base

#__last_scene, #__result_process, #running, #viewport

Attributes included from DisplayMessage

#message_window

Instance Method Summary collapse

Methods inherited from BaseCleanUpdate::FrameBalanced

#update

Methods included from Graphics::FPSBalancer::Marker

#frame_balanced?

Methods inherited from BaseCleanUpdate

#automatic_input_update, #update

Methods inherited from Base

#add_disposable, #call_scene, #dispose, #find_parent, #main, #return_to_scene, #snap_to_bitmap, #update, #visible, #visible=

Methods included from Input

dir4, dir8, get_text, joy_axis_position, press?, register_events, released?, repeat?, swap_states, trigger?

Methods included from DisplayMessage

#can_display_message_be_called?, #close_message_window, #display_message, #display_message_and_wait, #message_class, #message_processing?, #message_visible, #message_visible=

Constructor Details

#initialize(item_count, music_filename = DEFAULT_MUSIC) ⇒ MiningGame #initialize(wanted_item_db_symbols, music_filename = DEFAULT_MUSIC) ⇒ MiningGame

Initialize the UI

Overloads:

  • #initialize(item_count, music_filename = DEFAULT_MUSIC) ⇒ MiningGame

    Parameters:

    • item_count (Integer, nil)

      the number of items to search (nil for random between 2 and 5)

    • music_filename (String) (defaults to: DEFAULT_MUSIC)

      the filename of the music to play

  • #initialize(wanted_item_db_symbols, music_filename = DEFAULT_MUSIC) ⇒ MiningGame

    Parameters:

    • wanted_item_db_symbols (Array<Symbol>)

      the array containing the specific items (comprised between 1 and 5 items)

    • music_filename (String) (defaults to: DEFAULT_MUSIC)

      the filename of the music to play



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'scripts/01450 Systems/08001 Mining Game/00040 GamePlay_Mining_Game/00001 MiningGame_Initialize.rb', line 32

def initialize(param = nil, music_filename = DEFAULT_MUSIC)
  super()
  PFM.game_state.mining_game.nb_game_launched += 1
  @handler = PFM::MiningGame::GridHandler.new(param.is_a?(Array) ? param : nil, param.is_a?(Integer) ? param : nil, NB_X_TILES, NB_Y_TILES)
  @current_tool = :pickaxe
  @arr_items_won = []
  # @type [Yuki::Animation::TimedAnimation]
  @animation = nil
  # @type [Yuki::Animation::TimedAnimation]
  @transition_animation = nil
  # States are :mouse, :animation
  @ui_state = :mouse
  @mbf_type = :mining_game
  Audio.bgm_play(music_filename)
  @running = true
end

Instance Attribute Details

#arr_items_wonArray<PFM::MiningGame::Diggable>

Returns:



23
24
25
# File 'scripts/01450 Systems/08001 Mining Game/00040 GamePlay_Mining_Game/00001 MiningGame_Initialize.rb', line 23

def arr_items_won
  @arr_items_won
end

#tiles_stackUI::MiningGame::Tiles_Stack



21
22
23
# File 'scripts/01450 Systems/08001 Mining Game/00040 GamePlay_Mining_Game/00001 MiningGame_Initialize.rb', line 21

def tiles_stack
  @tiles_stack
end