Skip to content

Cannon.Display.Line

y-lohse edited this page Jan 6, 2013 · 3 revisions

Implements the Cannon.ChildSystem and the Cannon.DisplayObject.

Draws a line between 2 or more points. Cannon.Display.Line works with Vertex2D in thus depends on the Cannon.Math package !

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

Properties

nodes:Array

Array containing the different points building the line.

x:Float

Translates the whole line on the x axis.

y:Float

Translates the whole line on the y axis.

Functions

__construct:Line

Parameters

  • nodes:Array
  • x:Float : optionnal, default is 0.
  • y:Float : optionnal, default is 0.

Description

Creates a new line joining every point contained inside the nodes array.

Every node in the array should be a Cannon.Math.Vertex2D. If a node isn't, Cannon will try to build a new Vertex2D using the node's x and y properties. If again it can't find x and y properties, it will fail and send an error message to the Logger.