Saturday, February 6, 2016

Spread Eagle Cross the Block: Power Ups

Some quick updates for Screenshot Saturday:

  1. If an eagle is going left, it is pointed left now instead of right.
  2. Added the moon from the True Vulture music video onto the background stage (yes another stage).
  3. Added features for when a power up is gotten. Currently the power up feature (colorful background and faster driving speed) is triggered when the clock is hit (it wont be a clock in the final version, trust me)
These were just some quick changes for Screenshot Saturday. New stuff may be added tomorrow if I find time around the Super Bowl.

Here's a gif for you:

View post on imgur.com

Friday, February 5, 2016

Spread Eagles: Eagles on Point

On Wednesday there was a Google Developer Group meetup in Detroit. It was quite interesting and really inspiring. I felt so inspired, I pulled out my laptop and started working on Spread Eagles some more. During my time at the meetup I started to get the eagles to appear on screen. I had them following a path that would go to where you clicked, but for some reason they just kept going to the right, never the left. Turns out it was because I was still using the backdrop level camera as the stage for the eagles. Know what that means? I had to move all of my eagle code into a different class and make my own stage for them. At this point there are three different stages. One that holds the backdrop level, one that holds Ride's sprite, and one for the eagles to fly on. Later after the meetup I successfully got the eagle stage finished and had eagles flying the correct way. It was tedious, but necessary. The next day (yesterday) I tried to get the eagles to check collisions with the backdrop level. This was difficult for me. I was coming up with a rather lengthy algorithm for checking eagle coordinates against level coordinates. Why I didn't think about reprojecting the vector position from the eagle stage and unprojecting it from the level stage beats me, but that was the easiest solution to getting the position of where the eagle landed on the other stage. This was great because it didn't involve a lot of code, but I was still having some issues. First issue was that the level still didn't check the collisions correctly. It turns out that was because the y coordinate for drawing is always going to be upside down of the y coordinate for touch positions. Essentially, I thought I should have been checking for an eagle at 8,3, but really it was at 8,8 (my camera is 11 coordinates high so it was simple math of subtracting the y position from 11). The second problem was that sometimes the eagles were hitting multiple targets. This was because I had thrown a level together willy nilly and wasn't considering how close different hittable tiles were next to each other. After I redid the level a little bit and spread out the hittable tiles, it started to look much smoother. Next I will be building out the level to test how fun/playable it is, and I'll be adjusting speeds of both the camera and the eagles. I should also flip the eagle texture so when it goes left it actually points to the left. Here's a new screenshot:

Monday, February 1, 2016

Spread Eagle Cross the Block Weekend Update

I'm working on a game based off of Death Grips. It's called Spread Eagle Cross the Block and is about throwing eagles out of a car as MC Ride. If you're a fan you'll already know that Spread Eagle is a song off of their debut mixtape Exmilitary. The song is about sex and drugs, per the usual Death Grips themes, but I wanted to make a literal version off of the title of the track. I think it's coming together rather nicely. I was having some issues with the orthographic camera as it was making MC Ride's sprite appear as the buildings do. This weekend I learned about Scene2d and made a separate stage and a separate camera for Ride's sprite. The separate camera is setup the same as the main camera, but I don't project new sprites through that one. Essentially, Ride's sprite stays the same and looks like a skin or UI Widget that you don't interact with. Since I have fixed the issue with him and made the target icon appear directly where I click, I can now focus on getting the eagles to move from the bottom of the screen to where the player clicks. And don't think clicks means this is a desktop only game. I'm making the game in LibGDX so I do plan on releasing it on Android and iOS as well. I also hope to do a short tutorial series if all goes as planned. Here's a screenshot of what it currently looks like on my Android device:


Sunday, December 20, 2015

Understanding Android's Live Wallpaper Chooser

Ever since Android API 7 (2.1 Eclair) was released in January of 2010, developers had the option to produce live wallpaper applications for phones. This was great because this had not yet been implemented for iOS devices, and to my knowledge, still hasn't.* On those first devices that got API 7, if you wanted to change the wallpaper to a live one, you'd have to go through the phone's settings to do it. It was a couple of extra steps, but well worth it if you liked the feature. Later on in API 16 (4.1 Jelly Bean) developers could access the intent for changing the live wallpaper. This was great because users didn't have to go through the phone's settings to set the wallpaper anymore. Instead, they could press the 'OPEN' button on the app's page from the Google Play Store. It looked like this:

                                                 

Unfortunately for me, I didn't know this. Because I had stopped focus on my personal apps, there was a great length of time where users would install my live wallpaper app and all they would see is this:

                                                 

Users had become so accustomed to just pressing the 'OPEN' button to go to the wallpaper settings, that they had forgotten (or just didn't know) you could change the wallpaper from the phone's settings. This resulted in a lot of bad reviews for me :(

So, let's see what it takes to get the 'OPEN' button to appear for a live wallpaper app in the Google Play Store. Any normal Android app you download from the Play Store has a main activity (i.e. the screen you first see when it launches). The way this is set is in the manifest with the action tag and android.intent.action.MAIN set as its name. For example:
<activity
    android:name=".MainActivity"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
    </intent-filter>
</activity>

Live wallpaper applications run on a service, and guess what? Live wallpaper services need the action tag to be specific. It has to look like this:
<service
    android:name=".AnimatedWallpaperService"
    android:permission="android.permission.BIND_WALLPAPER" >
    <intent-filter>
        <action android:name="android.service.wallpaper.WallpaperService" />
    </intent-filter>
</service>

So what do we do? Well, we must make a separate activity (our main activity that is) that has the action tag. When this activity is run, it starts the ACTION_CHANGE_LIVE_WALLPAPER intent. This intent must be supplied with a Component Name object that has our specific wallpaper service attached to it. Essentially, this will start the live wallpaper chooser screen (intent), and because our wallpaper service is attached to it, it will look as if the user had already selected our wallpaper from the wallpaper chooser screen and is at the step to change it's settings or set it as the current wallpaper.

Let me show you:

First, create a new activity, this will be our Main Activity for the 'OPEN' button. Inside of that activity, include this code:
@Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {
        Intent intent = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
        intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
                new ComponentName(MainActivity.this, AnimatedWallpaperService.class));
        startActivity(intent);
        finish();
    } catch(Exception e) {
        Intent intent = new Intent();
        intent.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
        startActivity(intent);
        finish();
    }
}

For the ComponentName object, you must supply your wallpaper service class (don't include mine). This code does pretty much what I said in the last paragraph, but let me reiterate. First, we create the intent we want, which in this case is the Action Change Live Wallpaper intent supplied by the WallpaperManager class. We supply an extra to this intent, and that extra has our specific wallpaper class. That is the part where it knows to open the live wallpaper chooser and to choose our live wallpaper over any other one that might be on the user's phone. Finally, we start that activity and finish this activity (if we don't finish and the user presses the back button, it will come back to this activity which might result in a loop). But like all intents that that are external to your app, you must include a catch for any exception that could occur (i.e. the wallpaper service you included isn't found, the device isn't the right API for this intent, the device is bootleg, etc etc). In our situation, if the wallpaper can't be found or if it's the wrong API, we just make the activity open the Wallpaper Chooser and hope that the user chooses our wallpaper.

But we aren't finished! The manifest still needs to know to open this activity. Coincidentally, I already put that code up above, but I forgot to mention one part, the category tag. Our activity tag must have the action tag so that the phone knows which activity to start when the user selects to open the app from their app drawer or the Play Store, but how does the app get there? Well that's all in the category tag. All regular apps that you open from the app drawer have the category tag, and that category tag tells the phone top include the app in the app drawer when it is downloaded. It's also the tag that tells the Play Store to include the 'OPEN' button. So, make your activity tag in the manifest look more like this:
<activity
    android:name=".MainActivity"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.INFO" />
    </intent-filter>
</activity>

Now that your activity tag has the necessary category tag, with the correct name, it can now be accessed from your app drawer and from the Play Store.

* iOS 7 has dynamic wallpapers, but these aren't the same as Android's "live wallpapers." They are supplied on the phone or can be made from the user's pictures. There is not an API for developers to make their own dynamic wallpapers.

Wednesday, December 9, 2015

A New Leaf

Well here I am again, back at old Blogger.com. I started this blog as a way to promote my apps, ended up trying out some other blogs, didn't like those either and switched to just Twitter, and now I'm back. In coming back to Blogger, I hope to turn over a new leaf. Over the last few years I've learned a lot about mobile software development, marketing, graphic design, planning, etc etc. I feel that if I really want to retain this information, it would be beneficial to actually use the blog that I have, write it down, and share it with others. I'll be posting information regarding my current apps on the marketplace, coding tips, business tricks (the few I know), silly app ideas, and anything else I find intriguing about mobile app/game design. I'm currently learning Swift so I can start creating iOS apps as well, and I also plan on making smart-watch apps in the future, so you can expect to see me post quite frequently. Hopefully anything here is as beneficial to you as it was to me when I first learned it.