Monster Bingo - A Children's Halloween Game

Monster Bingo is a Halloween game for children written in Python that can be played outdoors with social distancing.

image

Monster Bingo Logo

 

In this blog I will tell you why I decide to make it, how it fits into Halloween in 2020, how to make a similar game yourself, or if preferred just play this one!

 

Halloween 2020

 

For quite a few years now I have made Halloween costumes and props for my grandchildren using electronics but this is 2020 and of course things are different.  This year there will be no children's parades or house to house trick or treating.  It is like the Grinch stole Halloween.  Instead my daughter asked if I could come up with a game they could play outdoors with a few other children in their immediate neighborhood.

 

What I came up with is Monster Bingo.  Monster Bingo has the following features that make it particularly suitable for children:

  • Plays faster than regular Bingo
  • Uses bright colors and Halloween pictures for pre-school children who can't read yet
  • Makes fun sounds
  • Easy to play
  • Runs on a Raspberry Pi or PC with Python
  • Candy!  Halloween Prizes!
  • Can be played outdoors in good weather with social distancing

 

Bonus:  If you have paper, printer and a Raspberry Pi or PC then you already have all the materials and equipment necessary at hand for this project.

 

Monster Bingo is played like regular Bingo but on a smaller card for faster play.  For those not familiar with the game there is an explanation here.  This year players will be seated in family groups, preferably socially distanced by at least 2 meters (72 feet, 6 ⁴⁷/₆₄ inches) and wearing masks.

 

In this version a smaller 4x4 card is used with Halloween themed images and colors instead of letters and numbers. We will use candy corn for Bingo place holders.  For those not familiar with candy corn it is an ubiquitous small waxy candy in the shape of a corn kernel artificially colored yellow, orange, and white dating back to the 1880s.  Purportedly the flavor is based on honey, sugar, butter, and vanilla.

image

Brach's Candy Corn from Wikipedia

 

Using candy corn is optional but makes it less likely that the players will eat the Bingo place holders image.  A Raspberry Pi or PC is used to make random draws and play sounds and music.  When a player gets 4 sequential squares filled either vertically, horizontally, or diagonally they yell "Trick or Treat" and come forward to select their prize off of a table.

 

Game Development

 

I started by hunting for suitable images on the internet, free for download.  The images used are simple, brightly colored and  quickly recognizable.  A good source for similar material are the websites that have icons like this one.  The images were modified to have similar outlines, simplified where needed, and colored red, green, blue, pink, and yellow in Photoshop.  Pink is my 4 year old granddaughters favorite color.  Had to use pink.  Below is an example of a ghost undergoing the changes described.

image

Editing the ghost image

 

In all, eight different Halloween images were created in five colors.  They were numbered 1 through 40 and saved as 600x600 images in jpeg format.

image

The monster characters

 

To make the Bingo cards another image was found on the internet to be used as background and modified to suit my needs in Photoshop.

image

Background modified from an image in DesignBolts

 

Thirty different card were generated in Photoshop with randomly placed Bingo pieces.  They are shown tiled together below before printing.

image

Full set of playing cards

 

After printing my grandson and I laminated them so that they might last a bit longer.

image

Making the playing cards

 

For the game I also wanted some background music, in particular Johann Sebastian Bach's Toccata and Fugue in D Minor.  If you don't know it by name you will recognize it when played.  Wikipedia has a nice writeup on the piece and there is a very wonderful interpretation played on the Trost-Organ of the Stadtkirche in Waltershausen, Germany by Hans-André here.  A ringtone free for download was found here that I could insert in the code.

 

Finally, I wanted each of the Bingo types to make a unique scary sound when displayed.  There are a lot of free sounds out on the internet and I just hunted around until finding some that were short in the 3 to 5 second range.

 

Python Script

 

Python and the Pygame module were used for the game.   Pygame is a free and open source library with multimedia sound and graphics that is well suited to simple games like Monster Bingo.  A Windows laptop is demonstrated here but as I needed something portable and battery powered but the game also runs on a Raspberry Pi.  The Python script is well documented and simple so a line by line description of how it works won't be done.

 

The Python program performs the following actions:

  1. Displays a welcome screen with directions while playing the background music
  2. When the user presses the space bar:
    • Randomly draw a monster piece and display a large image
    • Play the sound associated with the monster
    • Tile the image upper left to enable winning cards to be checked
    • Set timer to prevent another draw until 5 seconds pass
  3. Loop back to 2.

 

The user starts a new game by pressing the "n" key and can quit the game by shutting down the window or pressing the "q" key.

 

The welcome screen looks like this:

image

The splash screen with instructions

 

A game in play looks like this:

image

Game being played

 

Note that the window size is fixed at 1200 x 800.  A smaller or larger window requires that the script be modified by changing the window size and scaling the placement of the pieces and text.  Development was done in Python 3.8 on a Windows 10 machine.  The Python script is given below for those who would like to look inside.

 

"""
Halloween Bingo by F. Milburn
October, 2020

To play:
  space bar will draw the next monster for display
  monsters can only be drawn after 5 seconds has elapsed
  start a new game with the "n" key on the keyboard
  quit the game with "q" key or by closing the window
"""

# import modules
import pygame
from pygame import mixer
import random
import os

# set up the game
pygame.init()
screen = pygame.display.set_mode((1200, 800)) # window width, height
pygame.display.set_caption('Monster Bingo') # window caption
icon = pygame.image.load('jack-o-lantern.png') # window icon
pygame.display.set_icon(icon)

# background screen
bgd = pygame.image.load('background.jpg')

# empty list of monsters that will be popped from the randomized monster list
popMonster = []

# X, Y location for drawing a monster
monsterX = 200
monsterY = 200

# declare the monster images in a list
monster = [
  '1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.jpg', '8.jpg', # red
  '9.jpg', '10.jpg', '11.jpg', '12.jpg', '13.jpg', '14.jpg', '15.jpg', '16.jpg', # green
  '17.jpg', '18.jpg', '19.jpg', '20.jpg', '21.jpg', '22.jpg', '23.jpg', '24.jpg', # blue
  '25.jpg', '26.jpg', '27.jpg', '28.jpg', '29.jpg', '30.jpg', '31.jpg', '32.jpg', # purple
  '33.jpg', '34.jpg', '35.jpg', '36.jpg', '37.jpg', '38.jpg', '39.jpg', '40.jpg'] # yellow


# initializes a new game by shuffling monsters, clearing any drawn monster from the last game, and playing intro music
def init_game():

  # shuffle the monster images and clear the popMonster list
  random.shuffle(monster)
  popMonster.clear()

  # play background sound
  # JS Bach Toccata & Fugue in D-minor BWV 565 from www.ctunes.eu
  mixer.music.load("bach_toccata.mp3")
  mixer.music.play()


# displays instructions until the game has started
def display_instructions():

  yellow = (255, 255, 0)
  red = (255, 0, 0)

  tiny_font = pygame.font.Font("Deutsch.ttf", 16)
  small_font = pygame.font.Font("Deutsch.ttf", 50)
  large_font = pygame.font.Font("Deutsch.ttf", 100)

  text = large_font.render("Hello", True, red)
  screen.blit(text, (300, 300))
  text = large_font.render("Monsters!", True, red)
  screen.blit(text, (230, 400))

  text = small_font.render("For next monster", True, yellow)
  screen.blit(text, (850, 150))
  text = small_font.render("press space", True, yellow)
  screen.blit(text, (850, 220))
  text = small_font.render("For new game", True, yellow)
  screen.blit(text, (850, 360))
  text = small_font.render("press n", True, yellow)
  screen.blit(text, (850, 430))

  text = tiny_font.render("F Milburn Halloween 2020", True, yellow)
  screen.blit(text, (980, 750))


# game global parameters and initialization
gameStarted = False # displays instructions until true
updateWaitTime = 5000 # time to wait before allowing a new Bingo game update in milliseconds
updateTime = 0 # time at which a new update can occur
playing = True # turns false when game is exited
init_game() # initialize a new game

# game loop
while playing:

  # set the background (R, G, B)
  background = (0, 0, 0)
  screen.fill(background)

  # provision to end game by closing window
  for event in pygame.event.get():
  if event.type == pygame.QUIT:
  playing = False

  # check for pressed key and user input
  if event.type == pygame.KEYDOWN:

  # check if a request to draw a new monster was made by pressing the space bar
  # and that sufficient time has passed to allow an update to game play
  if event.key == pygame.K_SPACE and pygame.time.get_ticks() > updateTime:

  # set the game start to true and determine when next update to game play is allowed
  gameStarted = True
  updateTime = pygame.time.get_ticks() + updateWaitTime

  # pop a new monster image from the shuffled monster list for display
  popMonster.append(monster.pop())
  newMonster = pygame.image.load(popMonster[-1])

  # determine the type monster (there are 8 numbered types arranged sequentially in order of the 5 colors)
  # and play the associated sound for the monster
  stringNumber = popMonster[-1].split('.')
  monsterNumber = int(stringNumber[0]) % 8
  if monsterNumber == 7:
  scarySound = mixer.Sound("monster.wav")
  elif monsterNumber == 6:
  scarySound = mixer.Sound("house.wav")
  elif monsterNumber == 5:
  scarySound = mixer.Sound("ghost.wav")
  elif monsterNumber == 4:
  scarySound = mixer.Sound("cyclops.wav")
  elif monsterNumber == 3:
  scarySound = mixer.Sound("clown.wav")
  elif monsterNumber == 2:
  scarySound = mixer.Sound("cat.wav")
  elif monsterNumber == 1:
  scarySound = mixer.Sound("bug.wav")
  elif monsterNumber == 0:
  scarySound = mixer.Sound("witch.wav")

  scarySound.play()

  # check to see if a new game is requested with the n key
  elif event.key == pygame.K_n:
  init_game()
  gameStarted = False

  # check to see if a quit game is requested with the q key
  elif event.key == pygame.K_q:
  playing = False

  # draw the background image
  screen.blit(bgd, (0,0))

  # if the game has started then update the game state
  if gameStarted:

  # display the newest Monster
  screen.blit(newMonster, (monsterX, monsterY))

  # display the older Monsters
  xCoord = 830
  yCoord = 50
  for i in range(0, len(popMonster)):
  smallMonster = pygame.image.load(popMonster[i])
  smallMonster = pygame.transform.scale(smallMonster, (64, 64))
  screen.blit(smallMonster, (xCoord, yCoord))
  xCoord += 64
  if (i + 1) % 5 == 0:
  yCoord += 64
  xCoord = 830

  # else game has not started, give instructions for playing
  else:
  display_instructions()

  # update the display
  pygame.display.update()

 

The complete Python script, images, sounds, and fonts used in the game can be found in my github repository.  Download main.py and place it in a folder with the images, sounds, and font that are provided.  Print off the Bingo playing cards and buy some candy corn.  Run main.py using Python 3.x.  Enjoy image

 

Infomercial

 

A short demonstration of the game...

 

Conclusion

 

This was a fun project that everyone seemed to enjoy.  The parents in the neighborhood where my grandchildren live decided to have an early Halloween party this weekend with the children that live on that block.  Everyone wore a mask and the kids were pretty good about social distancing although my two granddaughters and the four girls that live on either side of them are in a "pod" that plays together and sat together.  There were a couple of younger children and they were able to play and it was fast enough to keep their attention. My grandson and I ran the table.  We kept calling characters and playing the games after Bingo was called until everyone had "won."

 

image

 

It could be adapted for other holidays and occasions such as birthdays or special events.  There are a lot of ways to extend and improve it such as adding additional playing card sizes.  Comments and suggestions are always welcome and I'm happy to answer questions in the comments below.

 

Useful Links

Github Repository for Monster Bingo

Related
Engagement
Recommended