Back

CreatePolygon

Hello World
Content:
- Methods

Creates a polygonal game object.

pol = gfx.CreatePolygon( points, pivotX, pivotY, color, lineWidth, lineColor, lineAlpha, group ) → app object: Polygon

Example

cfg.Game;

function OnLoad()
{
    polygon = gfx.CreatePolygon( [0.2,0.6, 0.8,0.6, 0.5,0.2, 0.2,0.6], 0, 0, 0x33ff55, 6, 0xcc1122 );
}

function OnReady()
{
    gfx.AddGraphic( polygon, 0.2, 0.7 );
    gfx.Play();
}
    Copy     Copy All       Run      

Methods

The following methods are available on the Polygon object:

alphanumber: fraction (0..1)
anglenumber: fraction (0..1)
Contains( x, y ) → boolean
dataobject
graphicunknown
groupstring
heightnumber: fraction (0..1)
pivotXnumber: fraction (0..1)
pivotYnumber: fraction (0..1)
scaleXnumber: factor
scaleYnumber: factor
Update()
visibleboolean
widthnumber
string
number: hexadecimal 0xrrggbb
number: fraction (0..1)
number: pixel
app object: Matrix
list: [ x1,y1, x2,y2, ... ]
The objects alpha value
The rotation fraction of the object
pol.Contains
Checks if a point is contained in the sprite
An object for saving individual extra properties.
The objects group identifier
The height of the object
The x pivot for rotations
The y pivot for rotations
The horizontal scaling
The vertical scaling
pol.SetMatrix
Set the individual 2d transformation
pol.Update
Updates internal properties
Indicates the objects visibility state
The obects width