Back

CreatePolygon

JS Py
Hello World
Content:
- Properties
- Methods

Creates a polygonal game object.

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

Example - 2

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();
}
# cfg.Game

def OnLoad():
    global polygon
    polygon = gfx.CreatePolygon([0.2,0.6, 0.8,0.6, 0.5,0.2, 0.2,0.6], 0, 0, 0x33ff55, 6, 0xcc1122 )

def OnReady():
    gfx.AddGraphic(polygon, 0.2, 0.7 )
    gfx.Play()
    Copy     Copy All       Run      

Properties

The following properties are available on the Polygon object:

alphaNumber: fraction (0..1)
angleNumber: fraction (0..1)
dataObject: { key, value }
graphicObject
groupString
heightNumber: fraction (0..1)
pivotXNumber: fraction (0..1)
pivotYNumber: fraction (0..1)
scaleXNumber: factor
scaleYNumber: factor
visibleBoolean
widthNumber

Methods

The following methods are available on the Polygon object:

Contains( x, y ) → Boolean
Update()
all types
String
Number: hexadecimal 0xrrggbb
Number: fraction (0..1)
Number: pixel
Object: Matrix
List: [ point_x_y ]
pol.alpha
The objects alpha value
pol.angle
The rotation fraction of the object
pol.Contains
Checks if a point is contained in the sprite
pol.data
An object for saving individual extra properties.
pol.graphic
the PIXI graphic
pol.group
The objects group identifier
pol.height
The height of the object
pol.pivotX
The x pivot for rotations
pol.pivotY
The y pivot for rotations
pol.scaleX
The horizontal scaling
pol.scaleY
The vertical scaling
pol.SetMatrix
Set the individual 2d transformation
pol.Update
Updates internal properties
pol.visible
Indicates the objects visibility state
pol.width
The obects width