AWRCollision library

Collision handling for rectangles.

File:
AWRCollision.lib
Version:
1.0
Author:
Marcus Johansson

Contents

Details
Sub routines


Details

This library lets you move a rectangle around in a world of rectangles with collision detection.


Subroutines

Name
Parameters
Brief description
function
AWR_MoveRect[]
&r[], dx, dy, &rects[][]
Move rectangle.
function
AWR_MoveRectF#[]
&r#[], dx#, dy#, &rects#[][]
Move rectangle.


Subroutine documentation

function AWR_MoveRect[] ( &r[], dx, dy, &rects[][] )

'r' is a rectangle [x, y, w, h] (top left corner, width and height) moving with the speed '(dx dy)'. 'rects' is an array of rectangles, [0..n][x, y, w, h] that prevents 'r' from moving. The function returns an array, [left, right, up, down] that tells you if there's been a collision in a certain direction. The position of 'r' is automaticly adjusted during collision.

Parameter
Mode
Description
r
In
The moving rectangle.
dx
In
X speed of rectangle.
dy
In
Y speed of rectangle.
rects
In
Rectangles that 'r' can collide with.

Return value
Collision information.

[ Back ]


function AWR_MoveRectF#[] ( &r#[], dx#, dy#, &rects#[][] )

This function works like 'AWR_MoveRect' but uses floating point coordinates.

Parameter
Mode
Description
r
In
The moving rectangle.
dx
In
X speed of rectangle.
dy
In
Y speed of rectangle.
rects
In
Rectangles that 'r' can collide with.

Return value
Collision information.

[ Back ]


Generated with NLDoc 20140630.