Skip to content

Cannon.Display.Rectangle

y-lohse edited this page Jan 2, 2013 · 2 revisions

Implements the Cannon.ChildSystem and the Cannon.DisplayObject.

Draws a simple rectangle.

This page only covers the properties and function that are particular for the rectangle, but the actual object will also contain all properties and functions from ChildSystem and DisplayObject.

Properties

x:Float

The x position of the rectangles top left corner

y:Float

The y position of the rectangles top left corner

width:Float

The rectangles width

height:Float

The rectangles height

center:Array

Contains the coordinates of the rectangles center in the form [x, y]

Functions

__construct:Cannon.Display.Rectangle

Parameters

  • x:Float
  • y:Float
  • width:Float
  • height:Float

Description

Creates a new Rectangle. All parameters are optional, the defaults are 0 for the coordinates and 50 for width and height

Example

var rectangle = new Cannon.Display.Rectangle(50, 50, 100, 20);