Back

CreateRectangle

JS Py
Hello World
Content:
- Properties
- Methods

Creates a rectangular game object.

rct = gfx.CreateRectangle( width, height, color, lineWidth?, lineColor?, lineAlpha?, group? ) → game object: Rectangle

Example - 2

cfg.Game;

function OnLoad()
{
    rect = gfx.CreateRectangle( 0.4, 0.4, 0x00ffff, 6, 0xee3355 );
}

function OnReady()
{
    gfx.AddGraphic( rect, 0.3, 0.2 );
    gfx.Play();
}
# cfg.Game

def OnLoad():
    global rect
    rect = gfx.CreateRectangle(0.4, 0.4, 0x00ffff, 6, 0xee3355)

def OnReady():
    gfx.AddGraphic(rect, 0.3, 0.2)
    gfx.Play()
    Copy     Copy All       Run      

Properties

The following properties are available on the Rectangle 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 Rectangle object:

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