A Pixel Off
The Misadventures of a Critical ThinkerCreating Android App: Goodbye World!
Posted on May 06, 2010I’m not going to get into the details of writing our first Hello World app. You can do this on your own if you want. I cheated, I’ve done it before. There are some important things to know how to do though. I’ve forgotten, so its good that I’m going over them again.
-
Start a new app
- Open Eclipse
- Go to New in the menu, then select Project.
- Drop down the arrow to the left of ”Android”
- Select “Android Project”
- Give your project a name (mine is “Blowing Up”)
- Below, we need to select a Build Target, or version of Android we want to make this for. This will make a difference since building for newer Android versions may render your application useless on older devices (and maybe the other way around as well, I don’t know yet.) Since I have a T-Mobile mytouch, I’m going to go with the 1.6 build.
- Give your application a name. This might be different than the project name. It reflects the actual name of your app. I’m naming it “Blowing Up” as well.
- Give your package a name (you said package). Basically, its the path to your classes. Often they’re like, “com.adobe” or something, so I’m going with “com.phillips”, then as I create more classes for other projects, I think it’ll keep it all nice and tidy under my name (maybe I’ll get famous!)
- I’m not 100% what the heck the Activity is. Probably some Java identifier thing. However, using the same naming convention that the Hello World tutorial used, I’m labeling my Activity “BlowingUp”.
- Click Finish
Right away I had 2 errors regarding not locating my gen directory or something. I just went to “Project” and then “Clean” and now its all good. I’ll get into the code and such later, for now I want to make sure my environments are all set up and working correctly. So, next…
-
Test it in the Android Emulator (or Android Virtual Device (AVD) as they call it)
- In Eclipse, choose Window > Android SDK and AVD Manager.
- Select Virtual Devices in the left panel.
- Click New.
The Create New AVD dialog appears. - Type the name of the AVD, such as “my_avd”.
- Choose a target. The target is the platform (that is, the version of the Android SDK, such as 2.1) you want to run on the emulator.
You can ignore the rest of the fields for now. - Click Create AVD.
- Close out any extra windows.
- Click on the green arrow button up top and ideally, after a minute or two, the Android emulator will appear. Possible even once the emulator appears that it’ll take forever for Android to start up on it.
Finally, need to test it on the Android device itself, but I don’t have my cable on me, so I’m saving that for later. I though it interesting to note that despite not having done anything, my brand new unmodified app had “Hello World, BlowingUp!” in it already.
Alright, everything is working, now to start programming!
Creating an Android App: Settin Up
Posted on May 03, 2010The Android Developer site gives you pretty much everything you need to get started. Particularly the Download the Android SDK page. Don’t get confused and start installing the links at the top of that page. There’s some other stuff you should get first, so either follow my list below or follow the instructions on the site.
Basically you need to download and install the following…
- The Java Development Kit (JDK)
- Eclipse. The Android site recommends using a Java or RCP version of Eclipse. 3.4 or 3.5 version of Eclipse is required to use the Android Development Tools plugin. Since I’m not one to argue with the Android Developer documentation, and since I’ll probably choose the wrong Java version of Eclipse, I’m going to use the RCP version of Eclipse (there’s only one…I can’t go wrong). I’d be happy to hear about what version others prefer. Make sure you decompress these files to somewhere you’ll remember. For ease, I’m going to give a link and assume instructions from here out as if you got the RCP version. I figure if you’re like me, you don’t want to have to figure all this stuff out, you just want to get started, right?
- Android SDK. This is the link at the top of the page that you should have skipped until now, even though its at the top of the page…make sure you note where you unzip these files, or unzip them to somewhere you’ll remember.
- Android Development Tool. This is a plugin for Eclipse, so you don’t just download and install it. You have to open Eclipse and follow the instructions under the Downloading the ADT plugin. If you got the RCP version, its like this…
- open Eclipse
- go to the Help menu
- click on Install New Software.
- click on the only button that says “Add”.
- type in “Android Plugins” for “Name:”
- paste in https://dl-ssl.google.com/android/eclipse/
- click OK.
- click the checkbox next to “Developer Tools”.
- click Next.
- click Next.
- (read and) click on “I accept the terms of the license agreement”.
- click Finish.
- (it’ll now download and Install stuff. If your experience doesn’t match mine at all, go to the link for this step and follow their instructions).
- Restart Eclipse.
- Add Android SDK Components. This is also done through Eclipse. Basically, you’re prepping Eclipse to think like different Android APIs.
- In Eclipse, click on the Window menu.
- click on Preferences.
- Select “Android” from the left menu.
- Insert or Browse to the location of where you unzipped the Android SDK from step 3 and click OK.
- click on the Window menu again.
- click on Android SDK and AVD Manager.
- click on “Available Packages” in the left menu.
- Not knowing for sure what I might need later on, I went ahead and installed all options, so just check any boxes in the right pane.
- Click OK and agree and stuff and wait a long time for stuff to install. Go drink some tea.
Once you’re done with all that, come back here, I have some more thoughts on the game.
Creating an Android App: Blowin Up the Marketplace
Posted on April 13, 2010My goal is to recreate my very first Flash game, Blowin Up, as an Android application. The premise of the game is that on one fine sunny day people suddenly start blowing up. Blowing up, like, explosions, not blood splatter. So anyway, you suspect that it may have to do with an alien ship landing not too far away, so it is your job to make it to the ship without getting yourself blown up by random people running by. At the end of the level, you face off against a giant alien ship.
So, before I can get started creating this application, it is best that I understand what I am trying to make. This will help me know what I’m going to need to learn. So, task #1 is to define the game.
The Logic
The logic is pretty simple.
Basics: You start with X number of lives. You run from the left side of the screen (in horizontal mode) to the right. When you reach the right side of the screen, the screen changes and you start on the left side again. People run out from the right or left side of the screen and explode anywhere on the screen randomly. Their explosion creates a burst around them. If you run into or are touched by the burst, you die. When you die, you start back on the same screen on the left side and we subtract a life from the X number of lives. When you run out of lives, the game is over. To win the game, you have to cross X number of screens until you reach an alien ship. Once you reach the ship, it flies above you back and forth and fires down at you. If you survive X amount of time of it shooting at you without running out of lives, then you win.
What we’ll need to know: We’ll need to figure out how to set an interval that will randomly decide wether or not to send out an exploding person. If the logic decides to send someone out, we need to randomly decide what side of the screen to send it out from. Once it runs out, we need to randomly decide where to explode. Once it explodes, we need to see if its burst comes into contact with the character. We’ll also need to figure out how to make the alien ship randomly move back and forth and fire down for X amount of time.
Movement: You move your character by clicking on the location you’d like him to run to. This is his destination point to which he will continue running to until you click someone else or he makes it across the screen. Once you make it across the screen, the screen changes to a new background, and you start back at the “beginning” of that screen. In the original Blowin Up, the game worked strictly horizontally, so you could only run right and left. To help keep this simple, we’re going to keep the side view (like Super Mario Bros).
What we’ll need to know: First, we need to know how to force the app to run in horizontal mode. The game would be rather short if you only had to run across the vertical screen. Then, we’ll need to figure out how to detect where a user presses on the screen and get the X position and make that the target position. Finally, we’ll need to know how to make the character move over time from its current X position to the target X position. There’s a few other things we’ll need to know, like how to animate the character as running when moving, but that’s just gravy for now, and I’m confident we’ll figure it out when we figure out how to move the character over time. Oh yea, we also need to know how to swap out the background as you get to the other side of the screen, and reset the character back to the left side.
To keep in mind: One of the challenges to the game is the movement control. You click on the screen anywhere, and your character runs to that point. If someone blows up in front of you, you’ll have to change your movement by clicking in the opposite direction. If it was as easy as using the arrow keys to move you (back when it was Flash), then avoiding explosions would have been easy and the game no fun. I think on the Android platform, it might be cool if character movement was defined by the user holding down the screen. So, to move back and forth, you just have to slide your finger either in front of back of the character instead of clicking. This might be really fun and cool and would take advantage of what touch screens offer, but it also might be the equivalent of using the arrow keys on your PC. It might make it too easy. So, this is something to keep in mind as I develop the app. It might make it really fun, but it also might make it lame. So if we see an opportunity to try it out once the game play has been established, lets try it and see how it affects the game play.
Scoring: The score is going to be based on a few things. Each person that blows up without killing you will add to your score. Each screen you complete will add to your score. If you finish the game, then the number of lives you have left will be used as a multiplier of your score. Also, the amount of time it took you to complete the game will also be taken into consideration (though I’m unsure how at this time).
The Graphics
Game Graphics: I’m going to just throw out that we’ll use 10 screens. 9 screens will be used while running to the alien ship, and 1 screen will be used for the alien ship. Since the user doesn’t actually interact with the background, the goal is to make them just kind of fun. The game is going to have a sense of humor to it, so animated backgrounds would be cool. Adding some popular references to action movies will be fun. We’re also going to need graphics for the main user, along with an animation sequence of him running, and a group of graphics and animations for the people that come running out and blowing up. Finally we’ll need a graphic for the alien ship. We also could use an animation of the ship crashing or something.
User Interface: For the interface, we’ll need an intro screen where you can start a new game, continue a game, view high scores, and one day, maybe, buy the pro version (help a brotha out!). During the game play, we’ll need a display for your current score, current screen #, and number of lives left. When the game is over, we’ll need to display a summary of your score, and if you won, a congratulations screen.
Oh yea, we also need an awesome icon.
Summary
I’m sure there’s a ton of stuff not covered here that we should be thinking about. However, I think this is plenty to get us started. Next up we’ll tackle downloading and installing the programs and tools needed for Android development.
Re-Blogged
Posted on April 13, 2010I keep thinking that I’ll use this blog space to document the many projects that I work on and launch almost weekly. However, I get worried and nervous that maybe I shouldn’t be revealing that kind of information about other people’s sites and such. So, instead, I’m going to use this space to document whatever current personal project I am working on. I’m sure that I’ll drop and pick up projects without completing this one, but documenting it will help keep me on track, right?
Okay, so this is the kick off of my latest interest…Android Apps. I recently created a simple buggy app for my employer, but its not an official app, it was more of an experiment to see if I could do it. Now that I know I can, I’m looking back and realizing I’m unsure of how I did it all. The places I started, the things I downloaded. So, I’m on my personal laptop and I need to get things started on here. I’ll be documenting the steps I take in hopes that maybe it’ll help someone else like me, who lacks the patience to read through things properly.
Recent Comments
Close block