gma.shapes.rectangle

Tags

shape

Properties

points

List of points that makes up the rectangle

Type

[many [x, y]]

edges

List of edges that makes up the rectangle

Type

[many [x1, y1, x2, y2]]

width

The width of the rectangle

Type

Number

height

The height of the rectangle

Type

Number

depth

The depth of the rectangle

Type

Number

z

The z co-ordinate of the rectangle’s centre

Type

Number

x

The x co-ordinate of the rectangle’s centre

Type

Number

y

The y co-ordinate of the rectangle’s centre

Type

Number

centre

List representing the rectangle’s centre

Type

[self.x, self.y]

left

The x co-ordinate of the left of the rectangle

Type

Number

right

The x co-ordinate of the right of the rectangle

Type

Number

top

The y co-ordinate of the top of the rectangle

Type

Number

bottom

The bottom co-ordinate of the bottom of the rectangle

Type

Number

yOffset

Amount to offset model in y axis when rendering it

Type

Number

xOffset

Amount to offset model in x axis when rendering it

Type

Number

type

Dictionary containing keys for each type the object is

Type

Dictionary

alive

Flag representing the alive/dead status

Type

Boolean

Default

true

solid

Flag representing the solid-ness

Type

Boolean

Default

true

tags

Hash containing tags
This should be specified as an array of strings, if at all.
Then each string in the list will be set to true in the resulting hash

Type

Object

Default

{shapes : true}

Methods

setPointsAndEdges ( )

Function to reset the rectangle’s points and edges

setCentre (centre)

Function to reset the rectangle’s points and edges

Parameters

centre

[x, y]

setBottomLeft (bl)

Function to reset the rectangle’s points and edges

Parameters

bl

[x, y]

Co-ordinates you want to move the bottom left corner of the entity to

xOf (side) -> Number

Determines the x coordinate of the side specified

Parameters

side

LEFT or RIGHT or null

yOf (side) -> Number

Determines the y coordinate of the side specified

Parameters

side

TOP or BOTTOM or null

toString ( ) -> String

Returns information about rectangle as a string

collided (where, focus, focusSide, focusVector)

Hook for when a collision with something occurs

Parameters

where

gma.constant

Side of this object that was collided with

focus

object

Thing we collided with

focusSide

gma.constant

Side of the focus object that was collided with

focusVector

[x,y]

Amount focus is trying to move

collided__deathtouch (where, focus, focusSide, focusVector)

Hook for when a collision with something occurs when we have deathtouch

Parameters

where

gma.constant

Side of this object that was collided with

focus

object

Thing we collided with

focusSide

gma.constant

Side of the focus object that was collided with

focusVector

[x,y]

Amount focus is trying to move