Zach Morgan > Collision-2D-0.07 > Collision::2D::Entity::Rect

Download:
Collision-2D-0.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Source  

NAME ^

Collision::2D::Entity::Rect - A rectangle entity.

DESCRIPTION ^

This is an entity with height and width. Attributes (x, y) is one corner of the rect, whereas (x+w,y+h) is the opposite corner.

ATTRIBUTES ^

w, h

Width and height of the rectangle.

METHODS ^

Anything in Collision::2D::Entity.

collide

See Collision::2D::Entity->collide

 print 'boom' if $rect->collide($rect);
 print 'zing' if $rect->collide($circle);
 print 'yotz' if $rect->collide($grid);

intersect

See Collision::2D::Entity->intersect

 print 'bam' if $rect->intersect($rect);
 # etc..
syntax highlighting: