Constructor
new Level(enemies, bosses, clouds, backgroundObjects, collectibleObjects, obstacles)
Creates a new Level instance with the specified content.
Parameters:
Name | Type | Description |
---|---|---|
enemies |
Array.<MovableObject> | All regular enemies in the level. |
bosses |
Array.<MovableObject> | Endbosses to fight at the end of the level. |
clouds |
Array.<Cloud> | Clouds to animate in the background. |
backgroundObjects |
Array.<BackgroundObject> | Non-interactive background visuals. |
collectibleObjects |
Array.<CollectibleObject> | Items the player can pick up. |
obstacles |
Array.<Obstacle> | Static objects that block or hurt the player. |
- Source:
Members
backgroundObjects :Array.<BackgroundObject>
All static background layers (e.g. hills, sky, trees).
Rendered in parallax and not interactive.
Type:
- Array.<BackgroundObject>
- Source:
bosses :Array.<MovableObject>
Endboss instances (typically one per level).
Special enemies with more health and unique behavior.
Type:
- Array.<MovableObject>
- Source:
clouds :Array.<Cloud>
Cloud objects that move independently across the level.
Used for visual depth (parallax effect).
Type:
- Array.<Cloud>
- Source:
collectibleObjects :Array.<CollectibleObject>
All items that can be collected by the player (e.g. coins, bottles).
Type:
- Array.<CollectibleObject>
- Source:
enemies :Array.<MovableObject>
Standard enemies (e.g. chickens, chonks).
Used for interactions and collisions with the player.
Type:
- Array.<MovableObject>
- Source:
level_end_x :number
X-coordinate where the level ends and the win condition is triggered.
Type:
- number
- Source:
obstacles :Array.<Obstacle>
Static obstacles like spikes or cliffs that block or damage the player.
Type:
- Array.<Obstacle>
- Source: