Class: HasEntitiesMixin

HasEntitiesMixin

HasEntitiesMixin is a Mixin to add a collection of Entity objects to a class.

Methods

addEntity(name, entity)

Add a entity to this container with the given name.
Parameters:
Name Type Description
name String The name to assign to the entity
entity Entity The Entity to add
Source:

drawEntities(context)

Draw entities
Parameters:
Name Type Description
context CanvasRenderingContext2D The context in which to draw
Source:

getEntity(name) → {Entity}

Return the entity with the given name. Throws an exception if the entity is not found.
Parameters:
Name Type Description
name String The name of the entity to return
Source:
Throws:
'Entity not found' if the entity is not found
Type
Exception
Returns:
The Entity with the given name if found
Type
Entity

redrawEntities()

Call redraw on all entities in this container by calling redraw()
Source:

removeEntity(name)

Remove a named entity from this container, will trigger a redraw if defined on the container class
Parameters:
Name Type Description
name String The name of the entity to remove
Source: