Class: GamePlay::Hatch

Inherits:
Base show all
Includes:
Math
Defined in:
scripts/01450 Systems/00303 Evolve/00003 GamePlay/00200 Hatch.rb

Overview

Scene showing the Egg of a Pokemon hatching

Constant Summary collapse

ENABLE_GIF =

Constant telling if you have gifs or not during the scene

true
EGG_MOVE_DURATION =

Move duration

180
EGG_MOVE_PERIOD =

Move period

60
EGG_MOVE_ANGLE =

Move angle

10
TONE_RED_MAX =

Max red component of the Viewport's tone when the egg is glowing

255 / 5
TONE_GREEN_MAX =

Max green component of the Viewport's tone when the egg is glowing

180 / 5
EGG_GLOW_START =

Time when the egg starts to glow

EGG_MOVE_DURATION + 1
EGG_GLOW_END =

Time when the egg stops to glow

EGG_GLOW_START + 180
EGG_GLOW_FACTOR =

The factor used in the glow alpha

255
VIEWPORT_GLOW_START =

Time when the viewport start to show the tone when the egg is glowing

EGG_GLOW_START + 30
VIEWPORT_GLOW_END =

Time when the viewport finish to show the tone when the egg is glowing

EGG_GLOW_END - 30
FLASH_START =

Time when the flash starts (pokemon shown, egg hidden)

EGG_GLOW_END + 1
FLASH_END =

Time when the flash ends

FLASH_START + 20
POKEMON_ALPHA_DOWN_START =

Time when the Pokemon starts to decrease it's color alpha

FLASH_START + 30
POKEMON_ALPHA_DOWN_END =

Time when the Pokemon ends to decrease it's color alpha

POKEMON_ALPHA_DOWN_START + 40
MAX_POKEMON_ALPHA =

Max alpha of the Pokemon color

230
EGG_MOVE_SE =

Name of the move file

'audio/se/pokemove.wav'

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 Base

#add_disposable, #call_scene, #dispose, #find_parent, #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

#initialize(pkmn) ⇒ Hatch

Create a new Hatch scene

Parameters:



43
44
45
46
47
48
49
50
# File 'scripts/01450 Systems/00303 Evolve/00003 GamePlay/00200 Hatch.rb', line 43

def initialize(pkmn)
  super()
  @pokemon = pkmn
  @egg = pkmn.clone
  @egg.step_remaining = 1
  @counter = 0
  play_music
end

Instance Method Details

#update

Update the hatching process



53
54
55
56
57
58
59
60
61
# File 'scripts/01450 Systems/00303 Evolve/00003 GamePlay/00200 Hatch.rb', line 53

def update
  @pokemon_gif&.update(@pokemon_sprite.bitmap)
  # Prevent animation from continuing when message is showing
  return unless super

  update_message
  update_animation
  @counter += 1
end