Re: rubygame
- From: "Bill Kelly" <billk@xxxxxxx>
- Date: Fri, 31 Aug 2007 16:51:46 +0900
From: "John Joyce" <dangerwillrobinsondanger@xxxxxxxxx>
Anymore explanation of axis-aligned rectangles? what do you mean axis- aligned? (i'm new at the game thing)
Considering the origin at the lower left corner of the screen,
you'd have the X and Y axes:
Y
^
|
|
|
+------> X
(Or sometimes Y is inverted, if your preference is to deal in screen-space Y coordinates increasing from
top of screen to bottom; but anyway...)
In 2D, an axis-aligned bounding box would be a rectangle defined by two points. The top and bottom
edges of the rectangle are parallel to the X axis,
and the sides are parallel to the Y axis.
This makes collision tests like point-in-rect, and
rect-rect-overlap extremely easy to write.
AABB's (axis-aligned bounding boxes) are of course
usually an imperfect approximation of the various-
shaped objects in a game; however for many games they
are sufficient. (Even recent popular 3D games like
Quake use AABB's for collision detection.)
If/when AABB's turn out to be too imprecise for a
game, there are all sorts of various methods to get
more collision resolution. In 2D, these could include:
collision mask shapes for sprites; other collision primitives like elipsoids or rhomboids; a quadtree
decomposition of fine-grained AABB's or rhomboids; etc.
But anyway, for your game I'd recommend either going
strictly tile based for simplicity; or going with
AABB's. My guess is most of your game should be fine with simple axis-aligned collision tests. If
at some point you have some really weird shaped
boss creature that needs something more precise than a rectangle for collision purposes, you could
deal with that when you get to it. (Often, just
using a few smaller rectangles instead of one big
rectangle can be good enough.)
The tiles in Zelda are actually smaller than they seem. Where you might think there is one tile, there are usually 4 tiles.
My biggest frustration will no doubt be getting the motion I want.
What sort of motion will that be? Are you talking about
how the whole world scrolls past the screen? Or how
various monsters animate as they move?
I want to basically recreate the game, though some boss enemies will be pretty tough to build, but ultimately I'd like to reinvent it with a new adventure with the same basic mechanics.
Sounds fun.
Regards,
Bill
.
- Follow-Ups:
- Re: rubygame
- From: John Joyce
- Re: rubygame
- References:
- rubygame
- From: John Joyce
- Re: rubygame
- From: Bill Kelly
- Re: rubygame
- From: John Joyce
- Re: rubygame
- From: Bill Kelly
- Re: rubygame
- From: John Joyce
- Re: rubygame
- From: Bill Kelly
- Re: rubygame
- From: John Joyce
- rubygame
- Prev by Date: Re: rake + FileUtils == warining
- Next by Date: WebServices & WSDL
- Previous by thread: Re: rubygame
- Next by thread: Re: rubygame
- Index(es):
Relevant Pages
|