Builderboy's Physics Lessons, Part IV: Virtual Pixel Testing

Submitted By: Builderboy Date: June 14, 2011, 03:57:04 pm Views: 1620

Virtual Pixel Testing

We all know about the basic command Pxl-Test() right?  It tests a pixel on the screen/buffer and returns whether or not the pixel is on or off.  This seems simple enough, but actually can be used to provide some fairly quick alternatives to using matrix based collision detection.  Not only are we eliminating the need to a matrix, but by simply drawing to the screen, we have already generated the data we will need for collision.  Eliminating the Matrix, as well as the time needed to spend writing to it, mean that pxl-testing is a formidable way to speed up your Basic or Axe game!

But, there are some issues with this.  What happens when your game requires tiles that might not be solid black?  We run into problems fast if we have complicated graphics, and have to resort to complex trickery in order to get collision to work.  One option is to have a single pixel in each tile of a tilemap be the indicator on whether or not the tile is filled or not, but this is hardly a perfect solution.  What if we wanted to be able to detect alternate things?  Like for instance certain tiles might slow down your character, or make them enter a swimming animation. Certainly we can

Rating: This article has not been rated yet.

Comments



Powered By SMF Articles by CreateAForum.com