Class: GamePlay::BaseCleanUpdate

Inherits:
Base show all
Defined in:
docs/4_Systems_000_General_2_GamePlay__Base.rb

Overview

Base Scene where you should not define update but dedicated update methods : “‘ruby

class MyScene < BaseCleanUpdate
  # Called when input can be updated (put your input related code inside)
  # @return [Boolean] if the update can continue
  def update_inputs
    # ...
    return true
  end

  # Called when mouse can be updated (put your mouse related code inside)
  # @param moved [Boolean] boolean telling if the mouse moved
  # @return [Boolean] if the update can continue
  def update_mouse(moved)
    return unless moved
    # ...
    return true
  end

  # Called each frame after message update and eventual mouse/input update
  # @return [Boolean] if the update can continue
  def update_graphics
    # ...
    return true
  end
end

“‘ All the update methods are optionnal but you should define at least one otherwise your Scene will be useless and softlock the game

Defined Under Namespace

Classes: FrameBalanced

Constant Summary collapse

AIU_KEY2METHOD =

List of methods to call based on the key that was pressed for automatic_input_update function

{A: :action_a, B: :action_b, X: :action_x, Y: :action_y, L: :action_l, R: :action_r, L2: :action_l2, R2: :action_r2, L3: :action_l3, R3: :action_r3, START: :action_start, SELECT: :action_select, HOME: :action_home}

Constants inherited from Base

GamePlay::Base::DEFAULT_TRANSITION, GamePlay::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 inherited from Base

#__last_scene, #__result_process, #running, #viewport

Attributes included from DisplayMessage

#message_window

Instance Method Summary collapse

Methods inherited from Base

#add_disposable, #call_scene, #dispose, #find_parent, #initialize, #main, #return_to_scene, #snap_to_bitmap, #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

This class inherits a constructor from GamePlay::Base

Instance Method Details

#automatic_input_update(key2method = AIU_KEY2METHOD) ⇒ Boolean

Automatically detect input update and call the corresponding action method

Examples:

Use the generic aiu

def update_inputs
  return false unless automatic_input_update
  # Do something else
  return true
end

Use aiu with specific functions

return false unless automatic_input_update(A: :action_a2, B: :action_b2)

Parameters:

  • key2method (Hash) (defaults to: AIU_KEY2METHOD)

    Hash associating Input Keys to action method name

Returns:

  • (Boolean)

    if the update_inputs should continue



281
282
# File 'docs/4_Systems_000_General_2_GamePlay__Base.rb', line 281

def automatic_input_update(key2method = AIU_KEY2METHOD)
end

#updateBoolean

Scene update process

Returns:

  • (Boolean)

    if the scene should continue the update process or abort it (message/animation etc…)



268
269
# File 'docs/4_Systems_000_General_2_GamePlay__Base.rb', line 268

def update
end