# EggHatchPhase | pokemon-rogue-battle
Documentation for pokemon-rogue-battle

# Class EggHatchPhase

Class that represents egg hatching

#### Hierarchy (View Summary)

- Phase
  - EggHatchPhase

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

##### Index

### Constructors

constructor

### Methods

doEggShake
doHatch
doReveal
doSpray
doSprayParticle
end
generatePokemon
sin
start
trySkip

## Constructors

### constructor

- new EggHatchPhase(
  hatchScene: EggLapsePhase ,
  egg: Egg ,
  eggsToHatchCount: number,
  ): EggHatchPhase

  #### Parameters

  - hatchScene: EggLapsePhase
  - egg: Egg
  - eggsToHatchCount: number

  #### Returns EggHatchPhase

  Overrides Phase.constructor

  - Defined in src/phases/egg-hatch-phase.ts:69

## Methods

### doEggShake

- doEggShake(
  intensity: number,
  repeatCount?: number,
  count?: number,
  ): 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/phases/egg-hatch-phase.ts:242

### doHatch

- doHatch(): void

  Plays the animation of an egg hatch

  #### Returns void

  - Defined in src/phases/egg-hatch-phase.ts:305

### doReveal

- doReveal(): void

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

  #### Returns void

  - Defined in src/phases/egg-hatch-phase.ts:339

### doSpray

- doSpray(intensity: number, offsetY?: number): 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/phases/egg-hatch-phase.ts:427

### doSprayParticle

- doSprayParticle(trigIndex: number, offsetY: number): 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/phases/egg-hatch-phase.ts:442

### end

- end(): void

  #### Returns void

  Overrides Phase.end

  - Defined in src/phases/egg-hatch-phase.ts:226

### generatePokemon

- generatePokemon(): PlayerPokemon

  Generates a Pokemon to be hatched by the egg Also stores the generated pokemon in this.eggHatchData

  #### Returns PlayerPokemon

  the hatched PlayerPokemon

  - Defined in src/phases/egg-hatch-phase.ts:487

### sin

- sin(index: number, amplitude: number): 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/phases/egg-hatch-phase.ts:418

### start

- start(): void

  #### Returns void

  Overrides Phase.start

  - Defined in src/phases/egg-hatch-phase.ts:76

### trySkip

- trySkip(): boolean

  Tries to skip the hatching animation

  #### Returns boolean

  false if cannot be skipped or already skipped. True otherwise

  - Defined in src/phases/egg-hatch-phase.ts:286