One thing I've noticed is that the basic game is there, but as a controlling player, I can pretty much go where ever I want (as long as I don't collide with a building object). I can completely fly out of shot, or fall through the invisible floor.
This would be a bit of a rubbish game artifact if I could just fly away and never know where the player UFO was.
The simplest solution is an invisible barrier around the game area, called my play area (I have a different play area for personal purposes)
This play area is just another bounding box and any time the player tries to move in any direction, I simply check to see if the player UFO bounding box will leave the play area bounding box. If it does then I don't let the player move.
Calculating the play area bounding box is very simple for this game.
I know the bottom left coordinates of my box as it will be the same coordinates as the bottom right bounding box of the first building cube drawn.
I also know the top right coordinates of my box as it will be the same as the top right bounding box of the last building cube drawn.
So all I need to do is when I'm generating the map, capture these two coordinates and create my bounding box out of those Min and Max values.
No comments:
Post a Comment