GameCoin

GameCoin

A class for representing a Coin object, which increases the player score when overlapped.

Constructor

new GameCoin(config, item)

Source:
See:
Parameters:
Name Type Description
config Object

Configuration

Properties
Name Type Attributes Default Description
scene Phaser.Scene

The Phaser.Scene where this is drawn

player ClubCrawler.Objects.Player

The player which can trigger the coin

spinrate number <optional>
4000

The angular velocity to apply when the coin is touched

item Phaser.Types.Tilemaps.TiledObject

item structured by Tiled as per Phaser.Types.Tilemaps.TiledObject

Properties
Name Type Attributes Default Description
properties.value number <optional>
1

The value of the coin as set in Tiled custom properties

Extends

  • Phaser.GameObjects.Image

Members

coinValue :number

Source:
Default Value:
  • 1

The value of the coin

Type:
  • number

spinning :boolean

Source:
Default Value:
  • false

Whether the coin has already been triggered

Type:
  • boolean

Methods

fadeCoin()

Source:

The fade out function for the coin. 'This' scope is the Coin, as applied by scene.time.delayedCall. Callback triggered on a timer after spinning starts. Shrinks coin and deletes it after it shrinks to nothing.

overlapWithPlayer(player, coin)

Source:

Callback function applied when player touches the coin. Increases the score and begins spinning the coin.

Parameters:
Name Type Description
player ClubCrawler.Objects.Player

The player

coin ClubCrawler.Objects.GameCoin

The coin