Class

Renderer

Renderer()

Entity Renderer
Constructor

# new Renderer()

View Source browser/lib/Renderer.js, line 8

Methods

# static beginRotationOffset(context, x, y, angle) → {void}

Calculate offset and begin rotating entity to given angle at position.
Parameters:
Name Type Description
context CanvasRenderingContext2D the canvas context for rendering
x number the entity x-coordinate
y number the entity y-coordinate
angle number the angle to rotate on the canvas

View Source browser/lib/Renderer.js, line 65

void

# static deadEnemy(context, color) → {void}

Draw dead enemy.
Parameters:
Name Type Description
context CanvasRenderingContext2D the canvas context for rendering
color Object the colors for the components

View Source browser/lib/Renderer.js, line 324

void

# static deadPlayer(context) → {void}

Draw dead player.
Parameters:
Name Type Description
context CanvasRenderingContext2D the canvas context for rendering

View Source browser/lib/Renderer.js, line 208

void

# static endRotationOffset(context, x, y, angle) → {void}

Stop rotating entity to given angle at position.
Parameters:
Name Type Description
context CanvasRenderingContext2D the canvas context for rendering
x number the entity x-coordinate
y number the entity y-coordinate
angle number the angle to rotate on the canvas

View Source browser/lib/Renderer.js, line 82

void

# static enemy(context, position, color) → {void}

Draw enemy.
Parameters:
Name Type Description
context CanvasRenderingContext2D the canvas context for rendering
position number the entity's position for feet animation
color Object the colors for the components

View Source browser/lib/Renderer.js, line 267

void

# static health(context, x, y, health) → {void}

Draw entity health bar.
Parameters:
Name Type Description
context CanvasRenderingContext2D the canvas context for rendering
x number the entity x-coordinate
y number the entity y-coordinate
health number the entity's health value

View Source browser/lib/Renderer.js, line 380

void

# static player(context, position) → {void}

Draw the player entity.
Parameters:
Name Type Description
context CanvasRenderingContext2D the canvas context for rendering
position number the entity's position for feet animation

View Source browser/lib/Renderer.js, line 97

void

# static render(context, entity) → {void}

Render the entity on the canvas. This method is called on every frame/repaint. It checks to see if the entity render state is active, and checks the entity type to apply specified behaviour and styles.
Parameters:
Name Type Description
context CanvasRenderingContext2D the canvas context for rendering.
entity Object the entity to render

View Source browser/lib/Renderer.js, line 21

void