News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

collision detection

Started by ghjjkl, July 13, 2014, 10:48:45 PM

Previous topic - Next topic

ghjjkl

recently i started thinking of fast collision detection between sprites and tiles which had been used in old dos/c64/zx spectrum/... programms. So there's my thinking:
all tiles should be aligned to tile grid. All the grid's cells must be the same size, power of 2, like 8x8, 16x16, 32x32 etc. It would make collision detection faster thanks to some bitwise operations. For example if sprite's position is 68, and tile's position is 64, to put sprite to right place i can simply do "and 68,64" and get sprite's position equal 64. But what if i want to detect collision between sprites? Should i use means like polygon intersection or this is wrong way?

ghjjkl