Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Making a game app?

Hi, I recently started the android app course, it is going super awesome! I want to create a simple app game like breakout and was wondering if it is possible on android studio and if i will need extra libraries or anything else. Any advice will be helpful!

5 Answers

Daniel Hartin
Daniel Hartin
18,106 Points

Hi Elite

Hi, probably a little late but I thought I would comment. I've recently created and published my first app which included a really simply 2D sprite game (similar to flappy bird - it's part of a larger app for a bus company in the UK). The code is not for the faint hearted to be honest as I tend to be messy (tut tut....) but it's not overly difficult like Seth mentions to paint everything to a canvas and do the math yourself. If you're interested I've pasted the code below (it's in 5 classes, obviously it imports a lot more but I wrote only 5 for the game) if you're just starting out this might seem quite a lot but it is quite fun building a game and challenging to get the maths right on all devices.

The main activity http://pastebin.com/tSc04fz2 The GameView (This is where everything is drawn to the screen) http://pastebin.com/RwwysBCs The Logic (This is where all the maths is done, a bit hacky in places) http://pastebin.com/c0XxhUqJ The Music http://pastebin.com/05kbkQd9 A helper class to hold all the screen object information http://pastebin.com/QYpJsZ1y

If you want to see the game in action go to https://play.google.com/store/apps/details?id=uk.co.trentbarton.skylink&hl=en

Hopefully all that hasn't put you off

Daniel

Wow I see, thank you! I will stick to something simpler since I will not have time to build the game haha, but thank you for posting the code! It helped me understand more the process to create a 2D game

jason chan
jason chan
31,009 Points

You can do that with unity game engine, but you have to be strong with unity and C# or javascript.

Seth Kroger
Seth Kroger
56,413 Points

In all honesty, you could do a simple breakout game without a full-bore game engine. After all, game engines didn't exist when the original was written. You can draw what you need on a Canvas and write your own code to track the ball and paddle.

jason chan
jason chan
31,009 Points

You can just do it in pure javascript, html, and css. Then have it all wrapped in the phone gap browser. phone gap makes your web application for mobile wrapped in web browser . It's also known as cordova.

I'll look into this after doing the android course, it sounds very interesting, thank you again!

Thank you both! I guess ill keep doing the course and at the end I will decide what to do, I might try a simple alarm app instead of breakout ^^