# Class EggHatchPhase

Class that represents egg hatching

#### Hierarchy (view full)

- Phase
  - EggHatchPhase

- Defined in src/egg-hatch-phase.ts:20

#####
Index

### Constructors

constructor

### Properties

canSkip
egg
eggContainer
eggCrackSprite
eggHatchBg
eggHatchContainer
eggHatchHandler
eggHatchOverlay
eggLightraysOverlay
eggMoveIndex
eggSprite
eggsToHatchCount
eggsToHatchCountContainer
evolutionBgm
hatched
infoContainer
pokemon
pokemonShinySparkle
pokemonSprite
scene
skipped

### Methods

doEggShake
doHatch
doReveal
doSpray
doSprayParticle
end
generatePokemon
sin
start
trySkip

## Constructors

### constructor

- new EggHatchPhase(scene, egg, eggsToHatchCount): EggHatchPhase

- #### Parameters

  - scene: default
  - egg: Egg
  - eggsToHatchCount: number

  #### Returns EggHatchPhase

  Overrides Phase.constructor

  - Defined in src/egg-hatch-phase.ts:64

## Properties

### `Private` canSkip

canSkip: boolean

- Defined in src/egg-hatch-phase.ts:59

### `Private` egg

egg: Egg

The egg that is hatching

- Defined in src/egg-hatch-phase.ts:22

### `Private` eggContainer

eggContainer: Container

The phaser container that holds the egg

- Defined in src/egg-hatch-phase.ts:38

### `Private` eggCrackSprite

eggCrackSprite: Sprite

The phaser sprite of the cracks in an egg

- Defined in src/egg-hatch-phase.ts:42

### `Private` eggHatchBg

eggHatchBg: Image

The phaser image that is the background

- Defined in src/egg-hatch-phase.ts:34

### `Private` eggHatchContainer

eggHatchContainer: Container

The phaser gameobject container that holds everything

- Defined in src/egg-hatch-phase.ts:32

### `Private` eggHatchHandler

eggHatchHandler: default

The scene handler for egg hatching

- Defined in src/egg-hatch-phase.ts:30

### `Private` eggHatchOverlay

eggHatchOverlay: Rectangle

The phaser rectangle that overlays during the scene

- Defined in src/egg-hatch-phase.ts:36

### `Private` eggLightraysOverlay

eggLightraysOverlay: Sprite

The phaser sprite that represents the overlaid light rays

- Defined in src/egg-hatch-phase.ts:44

### `Private` eggMoveIndex

eggMoveIndex: number

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

- Defined in src/egg-hatch-phase.ts:56

### `Private` eggSprite

eggSprite: Sprite

The phaser sprite of the egg

- Defined in src/egg-hatch-phase.ts:40

### `Private` eggsToHatchCount

eggsToHatchCount: number

The number of eggs that are hatching

- Defined in src/egg-hatch-phase.ts:25

### `Private` eggsToHatchCountContainer

eggsToHatchCountContainer: default

The container that lists how many eggs are hatching

- Defined in src/egg-hatch-phase.ts:27

### `Private` evolutionBgm

evolutionBgm: AnySound

The sound effect being played when the egg is hatched

- Defined in src/egg-hatch-phase.ts:62

### `Private` hatched

hatched: boolean

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

- Defined in src/egg-hatch-phase.ts:58

### `Private` infoContainer

infoContainer: default

The PokemonInfoContainer of the newly hatched Pokemon

- Defined in src/egg-hatch-phase.ts:51

### `Private` pokemon

pokemon: PlayerPokemon

The newly hatched PlayerPokemon

- Defined in src/egg-hatch-phase.ts:54

### `Private` pokemonShinySparkle

pokemonShinySparkle: Sprite

The phaser sprite for shiny sparkles

- Defined in src/egg-hatch-phase.ts:48

### `Private` pokemonSprite

pokemonSprite: Sprite

The phaser sprite of the hatched Pokemon

- Defined in src/egg-hatch-phase.ts:46

### `Protected` scene

scene: default

Inherited from Phase.scene

- Defined in src/phase.ts:4

### `Private` skipped

skipped: boolean

- Defined in src/egg-hatch-phase.ts:60

## Methods

### doEggShake

- doEggShake(intensity, repeatCount?, count?): Promise<void>

- 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<void>

  - Defined in src/egg-hatch-phase.ts:219

### doHatch

- doHatch(): void

- Plays the animation of an egg hatch

  #### Returns void

  - Defined in src/egg-hatch-phase.ts:278

### doReveal

- doReveal(): void

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

  #### Returns void

  - Defined in src/egg-hatch-phase.ts:310

### doSpray

- doSpray(intensity, offsetY?): 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

  - Defined in src/egg-hatch-phase.ts:390

### doSprayParticle

- doSprayParticle(trigIndex, offsetY): 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

  - Defined in src/egg-hatch-phase.ts:405

### end

- end(): void

- #### Returns void

  Overrides Phase.end

  - Defined in src/egg-hatch-phase.ts:203

### generatePokemon

- generatePokemon(): PlayerPokemon

- Generates a Pokemon to be hatched by the egg

  #### Returns PlayerPokemon

  the hatched PlayerPokemon

  - Defined in src/egg-hatch-phase.ts:450

### sin

- sin(index, amplitude): number

- 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

  - Defined in src/egg-hatch-phase.ts:381

### start

- start(): void

- #### Returns void

  Overrides Phase.start

  - Defined in src/egg-hatch-phase.ts:71

### trySkip

- trySkip(): boolean

- Tries to skip the hatching animation

  #### Returns boolean

  false if cannot be skipped or already skipped. True otherwise

  - Defined in src/egg-hatch-phase.ts:262