Post

 Resources 

Console


RE: Collision Detection. Peter (0 replies, 0 views) (2000-Sep-4)
-
If its the source I saw before then its Very Messed Up (tm). Its not a dig against your coding but there are too many arrays and types to just display the tiles and sprites. If I remember correctly there were like 3 subroutines just to draw the ground tiles. That's the problem and it would be smart to rewrite some of that. For example, store all your tiles in one array called Tiles and make a type called tTiles or something tTiles Type as integer CoorX as integer CoorY as integer end type Then type=1 would be grass, type=2 would be a road etc. Then just loop through your array and draw the tiles that way. It will lead to more trouble with the convulted way your code draws stuff now. As for collision detection, it is really simple. Just use IntersectRECT. Like in the code where you do your moving just use IntersectRECT to check where the sprite will be if that move is allowed and check that location against the impassable tiles. If its clear allow the move, if it isn't don't. It would be easiest to do that in a subroutine. There's an IntersectRECT tutorial at Lucky's site BTW. Peter DDCK: Myth of Creation www.talosstudios.com


-
Up One Level | Back to Forum


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