Class: GamePlay::MoveTeaching

Inherits:
BaseCleanUpdate::FrameBalanced show all
Includes:
MoveTeachingMixin, UI::MoveTeaching
Defined in:
scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00300 scene Initialize.rb,
scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00304 scene Mouse.rb,
scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00302 scene Inputs.rb,
scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00301 scene Graphics.rb,
scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00303 scene Processes.rb

Overview

Scene responsive of teaching a move to a Pokemon

How to call it ?

This scene has a return parameter called `learnt` telling wether the move has been learnt or not.
You might use call_scene like this for this Scene:
  call_scene(GamePlay::MoveTeaching, pokemon, move_id) { |scene| do something with scene.learnt }

Constant Summary collapse

AIU_KEY2METHOD =

List of methds associated to the inputs

{
  UP: :action_up, DOWN: :action_down, LEFT: :action_left, RIGHT: :action_right,
  A: :action_a, B: :action_b
}
CHOICE_TEXTS =

Actions of the scene Array containing the Yes No texts of a choice

[
  [23, 85], # Yes
  [23, 86] # No
]
LEARNING_TEXTS =

Array containing the texts of the scene

[
  [22, 99], # Pkmn wants to learn xxx
  [22, 100], # Which move should be forgotten?
  [22, 101], # 1, 2... Tadaa! Pkmn forget how to use xxx!
  [22, 102], # Give up on learning the move xxx?
  [22, 103], # Pkmn did not learn xxx.
  [22, 106], # Pkmn learned xxx!
  [11, 313] # You're good with having it forget xxx?
]

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

Attributes included from MoveTeachingMixin

#learnt

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(pokemon, skill_id) ⇒ MoveTeaching

Create a new Skill Learn scene param pokemon [PFM::Pokemon] param skill [Integer] or [Symbol]



14
15
16
17
18
19
20
21
22
23
24
25
# File 'scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00300 scene Initialize.rb', line 14

def initialize(pokemon, skill_id)
  super()
  @pokemon = pokemon
  @skill_id = skill_id
  @skill_learn = PFM::Skill.new(@skill_id)
  @skill_set_not_full = @pokemon.skills_set.size < 4
  @skills = @pokemon.skills_set
  @index = 4
  @learnt = false
  @state = :start
  @running = true
end

Instance Method Details

#create_graphics

Create the differents graphics of the UI



12
13
14
15
16
17
18
19
20
# File 'scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00301 scene Graphics.rb', line 12

def create_graphics
  super()
  create_background
  create_window
  create_pokemon_infos
  create_skill_description
  create_skills
  self.ui_visibility = false
end

#ui_visibility=(visible)

Set the visibility ON



23
24
25
26
27
28
# File 'scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00301 scene Graphics.rb', line 23

def ui_visibility=(visible)
  @base_ui.visible = visible
  @pokemon_infos.visible = visible
  @skill_description.visible = visible
  @skill_set.each { |sprite| sprite.visible = visible }
end

#update_graphics

Update the graphics every frame



6
7
8
9
# File 'scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00301 scene Graphics.rb', line 6

def update_graphics
  # TODO
  # New text blinking
end

#update_inputs

Update inputs every frame



10
11
12
13
14
15
# File 'scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00302 scene Inputs.rb', line 10

def update_inputs
  return message_start if @state == :start
  return false unless @state == :move_choice

  return update_buttons_inputs
end

#update_mouse(moved)

Function responsive of updating the mouse



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'scripts/01450 Systems/00301 MoveTeaching/00003 GamePlay/00304 scene Mouse.rb', line 4

def update_mouse(moved)
  return true unless moved || Mouse.trigger?(:LEFT)

  old_index = @index
  @skill_set.each_with_index do |skill, index|
    next unless skill.simple_mouse_in?

    @index = index
    swap_buttons(old_index)
    action_a unless moved
    break
  end
end