Pong Clone for Android

Behold… PONG!!! *gasps*

I built a Pong clone for Android. Ground breaking, I know. I needed to build an app from scratch for my college app development class, and I wanted to dabble in game development. So, a simple game like Pong seemed to be a good place to start.


Graphics were possibly the hardest part of this project. I just needed to create some simple blocks, but getting them to do what I needed proved harder than expected.

Android has many tools to make it easier to build apps. In particular, they have many shortcuts to build UIs. For example, Google developed UI tools that can automatically re-position a button or block of text so that app developers don’t have to worry about tweaking the UI for every single Android device. This is great for many apps, but this level of abstraction was bad for my game. Until I figured out how to create a simpler layout, the graphics would just disappear when I started the app.

Eventually, I figured out a bit of a hackish solution to make the graphics work. I created a FrameLayout, a UI element with minimal functionality, and added in graphic elements in program. I did find a more elegant solution online which I would’ve liked to implement. However, I was also simultaneously working on my senior research project, and I could only put so much time in both projects. Despite the inelegance, I did have a working example, so I continued using the graphics as they were.

Game Logic

Since I wasn’t using a tool like Unity, I was going to be building the game logic myself. Given my time constraints, this is also why I chose Pong: there wasn’t much logic to implement. There were really only two major aspects of the game logic.

First was goal detection. This was really simple. The ball’s position was checked to see if it was beyond either of the paddles, and added a point to the appropriate player.

Second was collision detection. Given how few objects were in game, collision was manually implemented for each object. The actual detection was done by using simple equality operations. If the position of the ball overlapped a paddle or wall, it’s direction would be reversed.

Other Thoughts

Really, the only other thing I find worth mentioning was touch control. The player’s paddle was controlled with simple touch gestures. The project rubric stated I need to use touch controls, and this seemed like an intuitive way to allow player control.

Possible Revisit

There’s a good chance I’m going to recreate this in Unity. It might seem excessive to make a Pong clone in Unity, but, I have some ideas up my sleeve, and Unity has a couple features that I want to use. For now, what exactly I’m planning is going to be a secret…

Leave a Reply