Posted By
|
Message
|
Retainer
Registered 02/06/2005
Points 218
|
22nd November, 2005 at 08:27:43 -
Is there a way to calculate this?
I'm making an isometric defend-your-town kinda game, and i want to check that a building im going to place out doesn't collide with something on the map. I'm using a snapping grid with the XMouse / 32 * 32, YMouse / 32 * 32 formula. Now the building are often overlapping other isometric squares (like a scyscrape for instance overlap several squares) so I can't do a normal collision detection.
Build house if:
bHouse.X > obstacle.X +63
bhouse.Y > obstacle.Y +63
or:
bHouse.X > obstacle.X +63
bhouse.Y < obstacle.Y -63
or:
bHouse.X < obstacle.X -63
bhouse.Y < obstacle.Y -63
or:
bHouse.X < obstacle.X -63
bhouse.Y > obstacle.Y +63
Would work if it was one object and one obstacle. Would take years to program in a whole game.
Is there a veteran sollution to this?
Alien Invasion. Going forward!
http://www.create-games.com/project.asp?id=1092
|
Retainer
Registered 02/06/2005
Points 218
|
22nd November, 2005 at 10:53:24 -
Ahaaah, you use Advanced Direction Object which is only available for MMF...
Too bad I'm stuck Multimedia Fusion Express...
Alien Invasion. Going forward!
http://www.create-games.com/project.asp?id=1092
|
Cecilectomy noPE
Registered 19/03/2005
Points 305
|
22nd November, 2005 at 14:57:48 -
use an x,y distance comparrison to calculate if its far enough from an object. youll still do it for each "object and obstacle" collision but it will cut the coding down by at least 3/4. and im not sure how to do this in isometrics.
p.s.- who were you talking to :-\
n/a
|
David Newton (DavidN) Invisible
Registered 27/10/2002
Points 8322
|
22nd November, 2005 at 16:25:38 -
You're using a snapping grid, so you could use an array object to mirror what's in that grid (set an X/Y value to 1 if there is something in that grid space, for example), and check the array every time something has to be placed.
http://www.davidn.co.nr - Games, music, living in America
|
Retainer
Registered 02/06/2005
Points 218
|
29th November, 2005 at 11:35:11 -
David Newton, your advice sounds very reasonable.
I created two 1000 global values objects, one named X and one Y.
When an object is placed at 320, 240, X value 320 is set to 1 and Y value 240 is set to 1. The problem with this is, that it blocks the whole 320 row and the whole 240 row... How do I do?
I figure that I would need some kind of 2D, that can store two cordinates. Dynamic Array 2 sounds perfect for this, but I can't dowload it!! 3EE is kinda broken.
Anyone know where I can download a copy? Or know a alternate way of doing this?
Alien Invasion. Going forward!
http://www.create-games.com/project.asp?id=1092
|
David Newton (DavidN) Invisible
Registered 27/10/2002
Points 8322
|
29th November, 2005 at 12:55:18 -
Isn't there an Array object already in the list? It might not be in MMF Express, I suppose.
The only thing that I can think of without using an Array is to simulate it using String objects, as they can contain a number of different paragraphs... but I'm not even sure if you can change the contents of them while the game is running. However, using any two objects that can store a list of values will do.
http://www.davidn.co.nr - Games, music, living in America
|
Retainer
Registered 02/06/2005
Points 218
|
30th November, 2005 at 03:35:50 -
To hell with this. As much as I love MMF Express, the possibilities with MMF is much better due to better support. (and working links). Can't even find a bloody array.
The problem was very easily solved with MMF array, thanks for all the help! Now I can even do the road laying engine I've trying to make so long
Alien Invasion. Going forward!
http://www.create-games.com/project.asp?id=1092
|
|
|