Difference between revisions of "love.physics.newRectangleShape"

(Added 0.8.0 variants.)
Line 1: Line 1:
Shorthand for creating rectangluar PolygonShapes.
+
Shorthand for creating rectanglar PolygonShapes.
  
The rectangle will be created at (x,y) in local coordinates.
+
== Function ==
 +
{{newin|[[0.8.0]]|type=variants|plural=yes}}
 +
=== Synopsis ===
 +
<source lang="lua">
 +
shape = love.physics.newRectangleShape( width, height )
 +
</source>
 +
=== Arguments ===
 +
{{param|number|width|The width of the rectangle.}}
 +
{{param|number|height|The height of the rectangle.}}
 +
=== Returns ===
 +
{{param|PolygonShape|shape|A new PolygonShape.}}
 +
 
 +
== Function ==
 +
=== Synopsis ===
 +
<source lang="lua">
 +
shape = love.physics.newRectangleShape( x, y, width, height, angle )
 +
</source>
 +
=== Arguments ===
 +
{{param|number|x|The offset along the x-axis.}}
 +
{{param|number|y|The offset along the y-axis.}}
 +
{{param|number|width|The width of the rectangle.}}
 +
{{param|number|height|The height of the rectangle.}}
 +
{{param|number|angle (0)|The initial angle of the rectangle.}}
 +
=== Returns ===
 +
{{param|PolygonShape|shape|A new PolygonShape.}}
  
 
== Function ==
 
== Function ==
 +
{{oldin|[[0.8.0]]|type=variant}}
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
Line 17: Line 42:
 
=== Returns ===
 
=== Returns ===
 
{{param|PolygonShape|s|A new PolygonShape.}}
 
{{param|PolygonShape|s|A new PolygonShape.}}
=== Note ===
 
love.physics.newRectangleShape() anchors from the center of the shape by default.
 
  
 
== See Also ==
 
== See Also ==

Revision as of 22:21, 9 April 2012

Shorthand for creating rectanglar PolygonShapes.

Function

Available since LÖVE 0.8.0
These variants are not supported in earlier versions.

Synopsis

shape = love.physics.newRectangleShape( width, height )

Arguments

number width
The width of the rectangle.
number height
The height of the rectangle.

Returns

PolygonShape shape
A new PolygonShape.

Function

Synopsis

shape = love.physics.newRectangleShape( x, y, width, height, angle )

Arguments

number x
The offset along the x-axis.
number y
The offset along the y-axis.
number width
The width of the rectangle.
number height
The height of the rectangle.
number angle (0)
The initial angle of the rectangle.

Returns

PolygonShape shape
A new PolygonShape.

Function

Removed in LÖVE 0.8.0
This variant is not supported in that and later versions.

Synopsis

s = love.physics.newRectangleShape( body, x, y, width, height, angle )

Arguments

Body body
The Body to attach the Shape to.
number x
The offset along the x-axis.
number y
The offset along the y-axis.
number width
The width of the rectangle.
number height
The height of the rectangle.
number angle (0)
The initial angle of the rectangle.

Returns

PolygonShape s
A new PolygonShape.

See Also


Other Languages