Class: Coin

Coin()

new Coin()

Source:

Extends

Members

height :number

Height of the coin in pixels. Affects how large the coin is rendered.
Type:
  • number
Source:

offset :Array.<string>

Array of image paths for the coin's animation frames. Used to alternate between two images for a simple spinning effect.
Type:
  • Array.<string>
Source:

width :number

Width of the coin in pixels. Affects how large the coin is rendered.
Type:
  • number
Source:

x :number

Horizontal position of the object
Type:
  • number
Inherited From:
Source:

y :number

Vertical position of the object
Type:
  • number
Inherited From:
Source:

Methods

animate()

Starts the animation loop for the coin, synchronized with the display refresh rate. Updates the coin's animation every 10 frames when in sync with world timing. Uses requestAnimationFrame for smooth rendering and optimal performance.
Source:

initCoinLoops()

Initializes the coin's animation loop once the world is ready. Uses a recursive setTimeout to wait for world initialization.
Source:

Coin(x, y)

new Coin(x, y)

Creates a new coin instance at the specified position. Loads all required images and initializes animation after world is ready.
Parameters:
Name Type Description
x number Horizontal position of the coin on the canvas.
y number Vertical position of the coin on the canvas.
Source:

Members

height :number

Height of the coin in pixels. Affects how large the coin is rendered.
Type:
  • number
Source:

offset :Array.<string>

Array of image paths for the coin's animation frames. Used to alternate between two images for a simple spinning effect.
Type:
  • Array.<string>
Source:

width :number

Width of the coin in pixels. Affects how large the coin is rendered.
Type:
  • number
Source:

x :number

Horizontal position of the object
Type:
  • number
Inherited From:
Source:

y :number

Vertical position of the object
Type:
  • number
Inherited From:
Source:

Methods

animate()

Starts the animation loop for the coin, synchronized with the display refresh rate. Updates the coin's animation every 10 frames when in sync with world timing. Uses requestAnimationFrame for smooth rendering and optimal performance.
Source:

initCoinLoops()

Initializes the coin's animation loop once the world is ready. Uses a recursive setTimeout to wait for world initialization.
Source: