bBasic - Adding some collision detection
Goals:
-> Implement player collision detection and hit point tracking.
Design:
-> Start from last entry.
-> Life and Shield strength bars at the bottom of the screen. Life is on the left, shield strength is on the right.
-> Collision detection of enemy shots and sprites hitting the player using hardware collision detection.
-> Shots hitting the player must be reset to bottom of screen to prevent hitting the player multiple times.
-> The shield protects the player from hits but loses its own strength.
-> The bottom most Enemy bat swoops down at the player by simply mulitplying the Ycount factor by 2.
-> A swooping bat can hurt the player only while descending. This is actually easier to implement since the sprites involved are on the screen together allowing use of hardware collision detection.
-> Make the player's shot looks different from shield.
-> Some color changes.
-> The player's color flashes when he is hit. The player is invulnerable while flashing. The upper nybble of the playerStatus byte is set to %1111 when the player is hit. It is decremented every odd frame and added to the player's base color on even frames to make the flashing effect.
Implementation:
Lessons learned:
-> I must remember to ues the built in bit operators to test/set single bits rather then coding them myself with bitwise instructions.
-> BUG? The bBasic compiler does not like the bitwise-& operator in the expression for a if-statement. It compiles to a CMP instructon with no branch, rather than a AND instruction followed by a conditional branch. I posted about this in the bBasic bug report thread.
Recommendations for improving bBasic:
-> None.
Up Next:
-> Adding more collision detection.
0 Comments
Recommended Comments
There are no comments to display.