Inspiration

This was inspired by the annual Halloween festive fun of Trick or Treating as well as time limited maze games.

What it does

It allows the player to upload any image into the game. This image is then processed and converted into a pixelated maze type map. Gelly the Ghost and Sweets are generated on top of this, added with a time limit. Controls allow for up-down & swivel movement. The player's aim is to collect all the sweets before the time runs out, but must be careful not to get Gelly lost in the forest or our friendly neighbourhood ghoul will take damage!

How we built it

We used a range of Python libraries. For the image conversation, we used the Python Pillow library, first converting the inputted image to black and white (this was originally converted to grey scale, however we added a threshold to ensure all pixels resulted in either Black or White colouring). We then eroded the B&W image multiple times to create larger grouped B&W pixels, then smoothed this out using Pillow Dilation and repeated multiple times to get a B&W (mostly block-ish) formatted map. To then add colour and Halloween forest inspired style, we ran through the pixels of the image, breaking it down into blocks and replacing the W with forest path like colours. We then ran it through again this time replacing blocks with a random selection of Pixel tree images to somewhat mimic forests for the map walls.

We made use of tkinter to allow users to interact and upload a image of their choosing to the game as their map.

The main game was created in Pygame. We used W-A-S-D controls for up-down and swivel movement on the ghost sprite. As well as allowed for sprite animation on movement. Game features include: time limit, collisions with collecting sweets as well as damage collisions with the forest map walls (Collisions were detected via live checking of surface colour).

Challenges we ran into

Ran into multiple issues with spawning Sprites and Sweets in valid map space. Due to unpredictable nature of images (especially reliant on user selection), we encountered problems with entities spawning on top of the damage forest zones or in pockets of valid forest path spaces that were unreachable within the game mechanics (without Gelly the Ghost dying). We made a mostly working solution using padding around the entities and more collision detection during spawn to keep the sweets within the playable bounds.

There was some challenges with the image processing, cycles of Erosion and Dilation taking a long time to complete. Also with breaking down images into blocks of pixels rather than individual pixels, the processed map often had random left over B pixels from the grey-scaling process. We countered this by creating a checker to ensure any trace of B pixels were replaced/covered by the forest trees.

Accomplishments that we're proud of

As this is our 1st ever hackathon and most of us are 1st Years (3/4), we're super happy to have created something whilst learning completely on the go! Getting the user input image processed and displayed was a big achievement (especially in our sleep deprived state at 3am) and seeing our sprite Gelly the Ghost flying around with animation made us quite proud :)

What we learned

How to use the python libraries Pygame & Pillow. Also that perseverance and adaptation can get you far!

What's next for Photo Phantom Scavenger Hunt Game

We'd love to add even more customisation to the maps. Further aesthetics to menu screen etc. Adding enemies or whimsical obstacles.

Built With

Share this project:

Updates