Class that represents egg hatching

Hierarchy (view full)

Constructors

Properties

canSkip: boolean
egg: Egg

The egg that is hatching

eggContainer: Container

The phaser container that holds the egg

eggCrackSprite: Sprite

The phaser sprite of the cracks in an egg

eggHatchBg: Image

The phaser image that is the background

eggHatchContainer: Container

The phaser gameobject container that holds everything

eggHatchHandler: default

The scene handler for egg hatching

eggHatchOverlay: Rectangle

The phaser rectangle that overlays during the scene

eggLightraysOverlay: Sprite

The phaser sprite that represents the overlaid light rays

eggMoveIndex: number

The index of which egg move is unlocked. 0-2 is common, 3 is rare

eggSprite: Sprite

The phaser sprite of the egg

eggsToHatchCount: number

The number of eggs that are hatching

eggsToHatchCountContainer: default

The container that lists how many eggs are hatching

evolutionBgm: AnySound

The sound effect being played when the egg is hatched

hatched: boolean

Internal booleans representing if the egg is hatched, able to be skipped, or skipped

infoContainer: default

The PokemonInfoContainer of the newly hatched Pokemon

pokemon: PlayerPokemon

The newly hatched PlayerPokemon

pokemonShinySparkle: Sprite

The phaser sprite for shiny sparkles

pokemonSprite: Sprite

The phaser sprite of the hatched Pokemon

scene: default
skipped: boolean

Methods

  • Function that animates egg shaking

    Parameters

    • intensity: number

      of horizontal shaking. Doubled on the first call (where count is 0)

    • Optional repeatCount: number

      the number of times this function should be called (asynchronous recursion?!?)

    • Optional count: number

      the current number of times this function has been called.

    Returns Promise<void>

    nothing since it's a Promise

  • Function to do the logic and animation of completing a hatch and revealing the Pokemon

    Returns void

  • Animates spraying

    Parameters

    • intensity: number

      number of times this is repeated (this is a badly named variable)

    • Optional offsetY: number

      how much to offset the Y coordinates

    Returns void

  • Animates a particle used in the spray animation

    Parameters

    • trigIndex: number

      Used to modify the particle's vertical speed, is a random number from 0-7

    • offsetY: number

      how much to offset the Y coordinate

    Returns void

  • Helper function to generate sine. (Why is this not a Utils?!?)

    Parameters

    • index: number

      random number from 0-7 being passed in to scale pi/128

    • amplitude: number

      Scaling

    Returns number

    a number

  • Tries to skip the hatching animation

    Returns boolean

    false if cannot be skipped or already skipped. True otherwise