UP DOWN READY

Hi there! You've probably reached this page from the Freeplay website in search of the elusive 'Up Down Ready' which took Best Design in this year's awards.

UPDATE: Hello! If you've arrived here from StumbleUpon, why not go play the game now on Kongregate! With high scores and EVERYTHING.

The versions of the game that were on this page were hosted on Dropbox. Since the recent spike in traffic, Dropbox has cut off access to my public folder. I will hopefully be migrating this stuff across to an actual server, but the version on Kongregate is the official release.

I'm Delia, the Sword Lady half of Sword Lady and the Viking. You can find my teammate over here. We are third year students in the Games Design course at Griffith University, and Up Down Ready (previously known as Horse) is our first semester project from this year, made using Adam Atomic's free Flixel library.

We entered it in the Freeplay Awards for a lark, and were incredibly surprised and excited to make it to the finals and take away an award. We hope you enjoy playing the game as much as we enjoyed making it!

- Delia
Showing posts with label flash. Show all posts
Showing posts with label flash. Show all posts

Saturday, September 25, 2010

Moderate success!

Well, Henrik and I just posted the mobile version of Up Down Ready on Kongregate. Which is, admittedly, almost identical to the desktop version bar a couple of bug fixes and the addition of some touch-based controls.

I've spent an unpleasantly harrowing couple of weeks working on this, compounded by the inability to access any flash-compatible Android phones on which to test it. I have learnt a lot, the most important thing being this: YOU GUYS, IT'S SWEET THAT ANDROID IS OPEN SOURCE AND ALL, I GET IT, THAT'S ADORABLE, BUT JESUS FUCK DEVELOPING FOR IT IS HORRIBLE*. Ensuring a consistent experience for all users is a massive headache when half of them have something like half the display resolution of the other half.**

Also half of them don't have flash yet - because it's not a case of 'everyone gets the latest OS all at once'***, but rather 'oh well here is the latest OS but Samsung hasn't put it out for THEIR phones in Australia yet, who knows why.'

And in ANY case, if you are running an actual, honest-to-goodness open-source distro of FroYo such as Cyanogen, while it may 'greatly extend the capabilities of your phone' this does not actually include the capability to run Flash, because Google apparently hasn't actually released the FroYo source code yet. Go figure.

On the other hand, the new Multitouch API in Flash Player 10.1 was surprisingly easy and pleasant to use (then again, it's Adobe, so my expectations were kind of low). Touch support detection is as simple as Multitouch.supportsTouchEvents (of course, there's another potential minefield here - you can also check Multitouch.supportsGestureEvents, and given that some phones support single touches but not gestures or multitouch, you would have to create multiple input methods and different UIs and - augh, see? It just snowballs.)

This was actually all I used Multitouch for - since I was using single touches, which also automatically fire MouseEvents in Flash, I just used mouse input. I also spent some time noodling around with scaling modes and alignment, so that it doesn't look completely pants when it goes to fullscreen mode.

ANYWAY. What I am saying is that we entered Up Down Ready in Kongregate's mobile games contest (we had to upload it as a new game to be under consideration for the competition, which I thought was a bit silly, but there it is) and now we are officially downing tools on it for this year. We will hopefully come back to it in the future, at such time as we feel we can make a significant leap in quality and depth of gameplay (possibly an iPhone port or similar).

For now, we move on to Snowball. We will be crunching heavily over the next few weeks to attempt to get something, you know, functioning.

- just stab the other guy in the face straight away, it saves time

*Compared to, say, developing for iPhone. I'M JUST SAYING. I concede that developing for desktop environments has always, and will pretty much always be a compatibility hassle, but that's a different ball game and outside the scope of this blog post.

**See also: I know half of you half as well as I should like, and I like less than half of you half as well as you deserve.

***Gosh wouldn't it be super convenient if all the users got the updates to the OS at the same time OH HEY THAT'S WHAT APPLE ALREADY DOES WITH THE IPHONE.

Saturday, May 29, 2010

News from the northern front, at last! Also: using SWC files with Flixel in Flex Builder 3

Ohai there.

Apologies to anyone reading for the lapse in posting over the last couple of weeks. THINGS have been HAPPENING.

The main thing being that within the space of the last week, I put together a resume and folio, went to an interview and got offered a job as a Flash programmer and game designer at 3 Blokes Studio. I'm to start next Thursday, so everything is a bit of a scramble at the moment.

ANYWAY.

I have been looking into better ways of importing assets in Flixel. It is kind frustrating and there aren't many good ways to do it, because Flixel really is designed to use embedded graphics. Which in the case of Horse will mean a zillion frigging lines of embedding all the sprites. This is not code which I want to have to write. And anything that involves reading files from a folder makes it a pain in the butt to put on the interwubs.

I just spent several hours looking into using an SWC exported from the Flash IDE as mentioned here. The linked post discusses how to do in a regular AS3 Project in Flex Builder, where you can happily access Flash's MovieClip or BitmapData classes with no problems.

Unfortunately it's not quite as simple for the Flixel library. In order to be useful, a graphic must be loaded into a FlxSprite instance so that all of Flixel's clever collision magic can happen. As far as I understand it (and I might be wrong), to do this, you need pass in a class that inherits from Bitmap - which is exactly what gets created when you embed an image directly in an AS3 file, thus:

[Embed(source = "data/bg2.png")] protected var ImgBG2:Class;

The Flash IDE, however, exports JPEGs and PNGs as extensions of the BitmapData Class, which Flixel's FlxSprite can't use as input.

I spent some time grovelling over these threads trying to figure out what to do - it seemed like the only way to use these BitmapData classes was to directly modify the .pixels property of the sprite, which sort of defeats the purpose of handing Flixel a spritesheet and telling it to go do its stuff.

But then I found THIS, which solves everything magically with a few lines. So thanks to Flixel forum user L_O_J for that fix.

Ok, so there is still some faffing around that needs to be done with loading the sprites. But I am content with the amount of embedding and related horrors that this will save me.

SO. Here is how to do it.

1. Open up Flash and import all your graphics into a new .fla file. (I'm going to assume you're clever enough to not need screenshots for this bit).

The next part unfortunately could be a bit of a grind, depending on how many assets there are.

2. Export the graphics for ActionScript. EDIT: Export in frame 1 MUST be ticked, or Flash won't export the files to an .SWC when you publish.



2a. Make sure the ActionScript class names DO NOT include a filename extension, such as .jpg or .png, because that makes ActionScript explode when you try to access the class. There doesn't seem to be a way to get flash to import files without including the extension, so yeah, this bit is not so great if you're doing it in bulk.

I would recommend taking the file extension off the end of the library item name and then selecting all the items and exporting them all in one go, rather than exporting one by one.



There's always this extension for Flash which you could use, but it's only useful if you don't need specific naming conventions.

3. Go to Publish Settings and make sure it is set to export an SWC file when it publishes

4. Publish the file

5. In Flex Builder, go to the properties for whatever project you want to use the assets in. Under ActionScript Build Path, click on Library Path and Add SWC, and point it to the SWC you just created.



6. This bit is crucial for use with Flixel! Add the following code to the FlxG.as file of the Flixel library, as shown here:

This at the top of the file:


// needed for processing bitmapdata

import flash.utils.getQualifiedSuperclassName;


And this in the addBitmap() function:


if(!checkBitmapCache(key))

{

//--------CHANGED CODE FOR PROCESSING BITMAPDATA FILES CONTAINED IN AN SWC

/*replaces/adds to the following line:

_cache[key] = (new Graphic).bitmapData;

code found at http://flixel.org/forums/index.php?topic=628.msg4563#msg4563

thanks to flixel forum user L_O_J*/

var classType:String = getQualifiedSuperclassName(Graphic);

if (classType.indexOf("BitmapData") == -1)

{

_cache[key] = (new Graphic).bitmapData;

}

else

{

_cache[key] = new Graphic(0, 0);

}

//---------------------------------------

if(Reverse) needReverse = true;

}

And there! You should now quite happily be able to access the files by class name as if they were embedded in the .as files, without the hassle of copying filepaths and assigning new class names.