Arcade Game

Jin Cui (jc3362) & Xu ouyang (xo28)



Warcraft shooting game is an interesting arcade game. No matter how old you are, you would enjoy warcraft shooting game.

Xu and me designed a warcraft shooting game based on the Pygame. The warcraft' s moving direction is controlled by four button. Besides, warcraft has two shooting and bomb buttons. We deisnged different kinds of aliens as well. Shooting different aliens  will get different score. High scores will be stored into the sqlite3 database. Players are able to know their scores and ranking.  


1. Designed game objectives by Pygame

2. Design collision detection and movement 

3. Load background and music

4. Implemented hardware to control the warcraft

Demonstration Video


We designed sprites python file. In this file, we have multiple classes. For example, we have Explosion class. If the warcraft is exploded, this class would be called and load the explosion picture and set the new sprite. We also have Missile and Bomb classes. These two classes are used for warcraft attacking. The fourth class is Powerup class. During the game, you may get new bomb or shield. The next two large class are ship and aliens. Ship class contains everything that our warcraft have.  Aliens class contains variables and methods that used by alien. Aliens' movements are designed in this class. can load picture and music for the game. is the main python file. In this file, we draw everything including warcraft, text, positions and many other stuffs. We also defined many variables like speed, background picture and music and use to load them. Every control part is included in this file as well.              


First of all, we tested in the monitor by running 'python3'. Figure 1 shows the result picture.   


Figure1: testing image


Because of the size of screen, we encountered a problem here was that the size of warcraft is a little bit  large so we used transform.scale to adjust the size of warcrafts.  

Then we wanted to test this on the PiTFT. We write code to control the warcraft by keyboard first. It works well but we need to use extra hardwares. What we designed was to control the warcraft by four direction buttons instead of the keyboard. So we used four buttons with callback method to substitute the keyboard. By doing this, buttons pressing can be detected and responsed without latency.    



Figure2: Hardware part

Right now, we could control the selection and warcraft as well by four buttons. Then we also designed shooting and bomb buttons by using the same strategy. We also used two GPIOs on the side of PiTFT as 'enter' and 'quit' buttons.



figure 3: GPIOs controll on PiTFT

Everything worked very well and we began to make a arcade game box.

figure 4: arcade box

The last step was intergrating every part together.  

figure5: outside view 

figure6: inner view


 We only used 6 buttons from Prof. Joe and using PiTFT and raspberry Pi. We didn't purchase anything.  


Everything works fine. However, we still had many problem when we were designing the game. For example, the size of warcraft picture is too large. If we used transform.scale to change the size, the resolution would decrease. Also, when we implemented the buttons to subsititute keyboard, the logics between using keyboard and using GPIOs are totally different.                    


Because there are too many code files. I upload code with this document together as a zip file.

References This project help us a lot about how to use pygame to design a game. Thanks.