Class: GamePlay::TCard

Inherits:
BaseCleanUpdate::FrameBalanced show all
Defined in:
scripts/01450 Systems/00104 Trainer/00003 GamePlay/00100 TCard.rb

Overview

Scene displaying the trainer card

Constant Summary collapse

PLAYER_COORDINATES =

Coordinates of the player sprite

[222, 49]
PLAYER_SURFACE =

Surface given to the player sprite

[80, 73]
BADGE_ORIGIN_COORDINATE =

Coordinate of the first badge

[14, 30]
BADGE_OFFSET =

Offset between badges (x/y)

[48, 49]
BADGE_SIZE =

Size of a badge in the badge image

[32, 32]
BADGE_COUNT =

Nmber of badge we can show in this UI

8

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

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

#initializeTCard

Create a new TCard interface



18
19
20
# File 'scripts/01450 Systems/00104 Trainer/00003 GamePlay/00100 TCard.rb', line 18

def initialize
  super(true)
end

Instance Method Details

#current_play_timeString

Function that returns the actual play time of the trainer

Returns:

  • (String)

    playtime formated like this %02d:%02d



24
25
26
27
28
29
# File 'scripts/01450 Systems/00104 Trainer/00003 GamePlay/00100 TCard.rb', line 24

def current_play_time
  time = $trainer.update_play_time
  hours = time / 3600
  minutes = (time - 3600 * hours) / 60
  format('%<hours>02d %<sep>s %<mins>02d', hours: hours, sep: text_get(25, 6), mins: minutes)
end

#update_graphics

Update the background animation



50
51
52
# File 'scripts/01450 Systems/00104 Trainer/00003 GamePlay/00100 TCard.rb', line 50

def update_graphics
  @base_ui.update_background_animation
end

#update_inputs

Make the UI act according to the inputs each frame



32
33
34
35
# File 'scripts/01450 Systems/00104 Trainer/00003 GamePlay/00100 TCard.rb', line 32

def update_inputs
  return @running = false if Input.trigger?(:B)
  return true
end

#update_mouse(_moved)

Called when mouse can be updated (put your mouse related code inside)

Parameters:

  • _moved (Boolean)

    boolean telling if the mouse moved



39
40
41
42
43
44
45
46
47
# File 'scripts/01450 Systems/00104 Trainer/00003 GamePlay/00100 TCard.rb', line 39

def update_mouse(_moved)
  if Mouse.trigger?(:left)
    @mouse_button_cancel.set_press(@mouse_button_cancel.simple_mouse_in?)
  elsif Mouse.released?(:left)
    @running = false if @mouse_button_cancel.simple_mouse_in?
    @mouse_button_cancel.set_press(false)
  end
  return true
end