View Single Post
Old 23 January 2019, 19:16   #35
Master484
Registered User
 
Master484's Avatar
 
Join Date: Nov 2015
Location: Vaasa, Finland
Posts: 525
In Blitz Basic there is one trick that works in Dual Playfield at least, when the playfield where the objects are drawn doesn't have any background graphics.

And the trick goes like this:
1. Clear screen.
2. Draw all enemies first.
3. Then draw bullets.

But before drawing each bullet, make a check if any graphics already exist in the Bitmap at the bullets XY location. So check if the colors present at that spot are anything else than 0. And if some graphics are present, only then make the actual collision checks for that bullet.

And if bullets are small, like 8*8, then checking only one pixels color at the middle of the bullet may be enough for reasonably accurate collision.

In Blitz there are 2 commands to do this sort of color check, called "BlitColl" and "Point", I'm not sure how you would do that in ASM.

This can speed up things quite a lot, because although the color check takes time, it allows us to skip the entire "bullet vs all enemies" list browsing in all those cases when the color at the bullets XY position was 0. And most of the time this is true, because 99 % of the time bullets don't hit anything, and when they do, they usually instantly die.

However this trick only works when there are no background graphics, so the game is Dual PF with backround GFX and game objects in separate playfields.

But maybe it could also work in a 16-color single PF game, if the screen is mostly black space, or if the palette is adjusted in such a way that only certain colors would cause a bullet collision and others would not.
Master484 is offline  
 
Page generated in 0.05913 seconds with 11 queries