Scary spot the difference using Python - Little Me



So, the other day I was getting a bit bored of regular old spot the differences. I needed some thing with a bit more potential. Then the idea popped. I would programme my own spot the difference in python. I skimmed through the good old raspberry pi book. (the ultimate source of my python knowledge📘) And sure enough there was a topic on coding a spot the difference. It was time for some coding!

First of all I had to download the images needed for the spot the difference. There was going to be a special spooky surprise at the end so that it not all boring old spot the difference. On the raspberry pi computer, a ready made spot the difference image had to be downloaded. Also an audio file had to be downloaded. Once I downloaded them and saved them in the home-folder I was all set to program.   

I made it first appear on the screen and then tried expanding the 'sleep' command (I got the sleep and randrange command from the digital library) to get it to appear on the screen for longer than a single second but all it showed was a black screen. I realised that I had skipped the step of making the picture adapting to the size of the particular screen. This process of stetting up the game is called 'initialisation'. Once I got that out of the way, what I did previously worked. Yay! Then I worked on showing the spooky image at the end at the same time as the audio. Finally, I ship shaped everything, checking for errors and indentation. Now everything was perfect but what's a programme by me without me changing a few things here and there. Or shall I say, Thenral customisation time!



I fiddled with the sleep command a bit and using the web found out how to randomise the time. I added some bits to the start and end to give it a more code likeness so that it does not immediately go into the puzzle with you not having a clue what its about. Soon enough the job was done and a new programme made it's way into the gallery of programmes. 

Popular Posts