• Create Account

## Bounding Box Tile detection

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1 Anonymous Poster_Anonymous Poster_*   Guests

Likes

Posted 28 September 1999 - 01:35 AM

Hi,

I am in the middle of programming a game using standard square tiles.

I need to know how can detect a non square object as part of the graphics, for example an isometric looking building, I want the building to be only detected around the edges not as part of the whole tile.

if anyone needs to know more please let me know my description is pretty vague.

### #2Rottz  Members

444
Like
Likes
Like

Posted 27 September 1999 - 01:24 PM

Hello!

Well, in fact I didnt understand very well :/
I'm not sure if I will be able to help (as Im not very good in programming), but I love to see which kind of problems do ppl have, so if (er, when) I have the same problems I know how to fix, and I love games of isometric view, and I try to make them, so I have a good chance of having same problems as other iso games programmers :P

Cya,
-RoTTer

### #3Sphet  Members

631
Like
Likes
Like

Posted 27 September 1999 - 02:41 PM

There's really no point drawing a circle using the full 360 degrees. A circle is symmetrical in all angles, so the fastest thing to do is to break a circle into octants, eight parts. Calculate the arc for one octant, and flip it around the x and y axis for all the other portions. There is some code that explains octants here but it might be a bit confusing.. there are other samples all over the place..

Make sure you use the lPitch member of the data returned from a DDSURFACE->Lock() call, not the assumed surface width (640, 800, etc) or else it'll look wonky.

### #4 Anonymous Poster_Anonymous Poster_*   Guests

Likes

Posted 27 September 1999 - 05:34 PM

This is only a few ideas, there are a number of ways to do this.

Most likely, you're going to need to store information seperate to the actual graphics of objects. In the case of a building, you could have perhaps a bounding polygon of some kind(a quadrilateral would do fine), or maybe some kind of mask for it, another graphic with only two colors, white or black, one of which tells where the building is, and one of which doesn't. That mask could be used for collision detection, or just to see whether or not you should draw over it.

There are a lot of ways to do this, and how you do it will pretty much depend on your own preferences, and what you need it for.

Good luck,
Jonathan

### #5Seyedof  Members

123
Like
Likes
Like

Posted 28 September 1999 - 01:35 AM

hi,
Is your objects treated as a tile or as a
sprite object?
if it's a non square sprite object, you can
divide it into some squares at the same size
of your tiles, for exact collision detection
some other Pixel Precision Collision Detection Methods

As i've exprienced before, it's not noticable
for the player that you have used tile
precision or pixel precision for your
object borders,...

------------------
--Ali Seyedof (It's all dark !)

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.