Post

 Resources 

Console


Another Q... Rag on a Stick (5 replies, 0 views) (2001-Jan-1)
-
Say you had a tile based game, with hundreds of objects, and you needed to do collision detection, how would you go about that using your method? (Assume only one object per tile unless you are really smart :) (My solutions) 1.) Use classes and have an object reference for each tile: Type Tile Walkable As Boolean Terrain As TerrainConstants ObjectOn As cGameObject End Type Then when an object moved to a square: Set Map(ThisObject.X, ThisObject.Y).ObjectOn = ThisObject Set Map(ThisObject.OldX, ThisObject.OldY).ObjectOn = Nothing That solution probably looks the nicest =) 2.) Store the index of the array in the Tile type: Type Tile Walkable As Boolean Terrain TerrainConstants ObjectIndex As Integer End Type Hey cool, I hadn't thought of that yet... pretty much the same as above... though most likely faster =) 3.) Sort the objects somehow, say all objects who have a lower index are to the left of those of a higher index. I know that Corre's Mr FroOonk did this... although I never got to play it, I had a poke through the source (never could get it to run :( ) 4.) Dictionary using coordinates as keys and objects as definitions.... I think it would get ugly. That's about all of my ideas (for one object per square at least)... anyone care to add to this?


-
Up One Level | Back to Forum

I just have a Walkable value... Jack Hoxley (4 replies) (2001-Jan-1)
But what if... Rag on a Stick (3 replies) (2001-Jan-1)
Re: But what if... Jack Hoxley (0 replies) (2001-Jan-2)
Re: But what if... Philipp (1 reply) (2001-Jan-5)
Seems good Jack Hoxley (0 replies) (2001-Jan-6)

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.
There have been 92 visitors within the last 20 minutes
RSS News Feed