Constructor
new ChunkUnit(chunk, x, y, sprite)
Create a new chunk unit.
Parameters:
Name | Type | Description |
---|---|---|
chunk | Chunk | Parent space chunk |
x | number | Global position along x-axis |
y | number | Global position along y-axis |
sprite | string | | Sprite, sprite identifier, or color for drawing |
Methods
draw(ctx)
Draw the chunk unit.
Parameters:
Name | Type | Description |
---|---|---|
ctx | CanvasRenderingContext2D | Canvas context to draw on |
update(elapsed)
Update the unit.
Parameters:
Name | Type | Description |
---|---|---|
elapsed | number | Time since last update cycle in seconds |