Creates a polygonal game object.
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();
}
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()
Properties
The following properties are available on the Polygon object:
alpha →
Number: fraction (0..1)
angle →
Number: fraction (0..1)
height →
Number: fraction (0..1)
pivotX →
Number: fraction (0..1)
pivotY →
Number: fraction (0..1)
Methods
The following methods are available on the Polygon object:
all types
String
Number: hexadecimal 0xrrggbb
Number: fraction (0..1)
Number: pixel
Object: Matrix
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