FHBG (Forehead Block Guy) remake in Python

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
FHBG (Forehead Block Guy) remake in Python
by on (#112810)
In this post, mbrenaman wrote:
FHBG: Very unique, though, I think something is wrong with the collision detection. The player's character kept getting stuck on the walls

So I decided to fix it. I looked at the source code and it was a mess. I ended up rewriting it in Python+Pygame in preparation for porting it back to the NES as an example of good practices in platformer physics. This way I could tune the physics and game balance to make a reference implementation in a more forgiving environment.

In this first public beta release, I'm looking for feedback on game bugs and balance as well as presets for more gamepads.

Download PyFHBG | Video

They came back and found the facility trashed and crawling with vermin. Not only that, but without any staff to protect, the sneakers were caring for the vermin. So they called an exterminator.

How to play
Stun each enemy by tossing a block at it, then touch it while stunned to kill it. Defeat all enemies in the room or grab all chips to continue.

PyFHBG is written in Python using the Pygame library, a wrapper around SDL.
On Ubuntu and possibly other Debian-based distributions, do sudo apt-get install python-pygame
On Windows, install Python 2.7.5 (Win32) and Pygame 1.9.1 for Python 2.7 (Win32)

Game changes
The game is based on the NESdev Compo 2011 version of FHBG, but I've been polishing it.
  • Redrew all sprite graphics
  • Life meter is a vertical stack of hearts, like SMB2
  • Sneakers can crouch into the shell and absorb one block
  • All toasters toast toast
  • Practice mode to play a single level at a time
  • Fixed all collision rectangles
  • Replaced getting stuck in the wall with more predictable hanging from ledges
  • Must pick up a block before throwing it
  • Travel between levels and an outer room through doors
  • Added "collect the chips" levels based on FHBG-SDL
  • Field is not as tall, for compatibility with widescreen LCD TVs
  • Excuse plot
  • Level editor supports editing enemy list

Pygame engine features
  • Sound effects are synthesized at runtime using the same data format as my NES music engine
  • Controller configuration
  • Automatic configuration for several brands of controller
  • Ctrl+P for screenshot
  • Video recording (hidden)

Remaining tasks
  • Complete fourth floor
  • Music
  • Ending
  • Collect fhbg.kyb configuration files for more brands of controller
  • Further play-testing
  • Port it all back to the NES
  • Use what I learned in a more ambitious project with scrolling