Difference between revisions of "love.physics.newRectangleShape"

(Synopsis)
m (add variant that takes body argument)
Line 2: Line 2:
  
 
By default, the local origin is located at the '''center''' of the rectangle as opposed to the top left for graphics.
 
By default, the local origin is located at the '''center''' of the rectangle as opposed to the top left for graphics.
 +
 +
== Function ==
 +
{{newin|[[12.0]]|120|type=variants|plural=yes}}
 +
=== Synopsis ===
 +
<source lang="lua">
 +
shape = love.physics.newRectangleShape( body, width, height )
 +
</source>
 +
=== Arguments ===
 +
{{param|Body|body|The Body to attach the Shape to.}}
 +
{{param|number|width|The width of the rectangle.}}
 +
{{param|number|height|The height of the rectangle.}}
 +
=== Returns ===
 +
{{param|PolygonShape|shape|A new PolygonShape.}}
  
 
== Function ==
 
== Function ==

Revision as of 18:52, 5 July 2024

Shorthand for creating rectangular PolygonShapes.

By default, the local origin is located at the center of the rectangle as opposed to the top left for graphics.

Function

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

Synopsis

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

Arguments

Body body
The Body to attach the Shape to.
number width
The width of the rectangle.
number height
The height of the rectangle.

Returns

PolygonShape shape
A new PolygonShape.

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