Lunarbeam
|
This seems like an incredibly useful thing to have, so here goes:
How about a function called trace() that accepts two pairs of tile coordinates and a layer number. It then traces a ray from the first pair to the second. It returns a value from 0 to 100: 0 being that it started in an obstruction on that layer, 100 being that the trace was completed succesfully. Using this method, you can determine the exact location of the collision, too. Yes, I know that it would probably be possible to write this in Verge myself, but the code would probably end up being slow, running in an interpreter and all.
Some tips on writing it:
1) You don't need to check the whole map for elements to collide with. All you need to check is a box drawn by the first and last coordinate.
2) Since tiles are so big (16x16) you only need to check for collisions periodically.
Anyway, thanks for listening. This function would be greatly appreciated...
Posted on 2001-01-01 13:54:31
|