Constructor
new BubbleFactory(game)
Create a score bubble.
Parameters:
Name | Type | Description |
---|---|---|
game |
SpaceInvaders | The current game. |
- Source:
Extends
Methods
canMake() → {boolean}
Check if we can make a new instance based on maxItems
- Inherited From:
- Source:
Returns:
- Type
- boolean
destroy(item) → {Object}
Destroy an instance created by this factory
Parameters:
Name | Type | Description |
---|---|---|
item |
Object | The item / instance to destroy |
- Inherited From:
- Source:
Returns:
Returns the instance created
- Type
- Object
make(type, value, startX, startY) → {boolean}
Public make method to make new bubbles. Overides extended Factory.make method.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Type of bubble (score, health, damage). |
value |
number | Value of the bubble. |
startX |
number | Starting X position. |
startY |
number | Starting Y position. |
- Overrides:
- Source:
Returns:
True if bubble is made.
- Type
- boolean
makeItem(type, value, startX, startY) → {Bubble}
Private makeItem method to make new bubbles.
Parameters:
Name | Type | Description |
---|---|---|
type |
string | Type of bubble (score, health, damage). |
value |
number | Value of the bubble. |
startX |
number | Starting X position. |
startY |
number | Starting Y position. |
- Overrides:
- Source:
Returns:
The bubble made.
- Type
- Bubble
reset()
Destroy all items and reset the data
- Inherited From:
- Source:
resetCountdown()
Restart the auto make countdown based on max / min delay
- Inherited From:
- Source:
update()
Main update loop
- Inherited From:
- Source: