Class: DrawObjectFactory

DrawObjectFactory

Creates drawObjects instances.
accessible via GameStage.draw
Attach images for image objects and tilemaps
Adds drawObjects to current GameStage.stageData
Source:
See:

Members

stageData

Source:

Methods

circle(radius, bgColor) → {DrawCircleObject}

Parameters:
Name Type Description
radius number
bgColor string rgba(r,g,b,a)
Source:
Returns:
Type
DrawCircleObject

conus(radius, bgColor, angleopt, fadeopt) → {DrawConusObject}

Parameters:
Name Type Attributes Default Description
radius number
bgColor string rgba(r,g,b,a)
angle number <optional>
fade number <optional>
0 (0 - 1)
Source:
Returns:
Type
DrawConusObject

image(x, y, width, height, key, imageIndexopt, boundaries, spacingopt) → {DrawImageObject}

Parameters:
Name Type Attributes Default Description
x number
y number
width number
height number
key string
imageIndex number <optional>
0
boundaries Array.<{x:Number, y:Number}> | Object boundaries as polygon, or circle
spacing number <optional>
0 for tilesets.spacing > 0
Source:
Returns:
Type
DrawImageObject

line(vertices, color) → {DrawLineObject}

Parameters:
Name Type Description
vertices Array.<number>
color string rgba(r,g,b,a)
Source:
Returns:
Type
DrawLineObject

polygon(vertices, bgColor) → {DrawPolygonObject}

Parameters:
Name Type Description
vertices Array.<{x:number, y:number}> should go in anticlockwise order
bgColor string rgba(r,g,b,a)
Source:
Returns:
Type
DrawPolygonObject

rect(x, y, width, height, backgroundColor) → {DrawRectObject}

Parameters:
Name Type Description
x number
y number
width number
height number
backgroundColor string rgba(r,g,b,a)
Source:
Returns:
Type
DrawRectObject

text(x, y, text, font, color) → {DrawTextObject}

Parameters:
Name Type Description
x number
y number
text string
font string size fontFamily
color string rgba(r,g,b,a)
Source:
Returns:
Type
DrawTextObject

tiledLayer(layerKey, tileMapKey, setBoundariesopt, shapeMaskopt) → {DrawTiledLayer}

Parameters:
Name Type Attributes Description
layerKey string
tileMapKey string
setBoundaries boolean <optional>
shapeMask DrawShapeObject <optional>
Source:
Returns:
Type
DrawTiledLayer