Archive for the ‘Flash’ Category

This week in the news

Wednesday, October 7th, 2009

Adobe MAX is going on right now in Los Angeles, California, and while I wasn’t one of the lucky few selected to attend from my company this year (not sour grapes, I went to Chicago in ‘07 and had a blast), I have had to follow it’s updates through Twitter.

Anyway, Monday morning they made an announcement that when Flash CS5 is released, you will be able to port Flash games, applications, etc. to native iPhone apps. For a Flash developer like me, this has been a long time coming and I have to say I’m excited.

Couple this with the news that Bell (my cellphone provider) has recently confirmed they will be selling the iPhone next month, and you have someone in me who I would title as an “eager-soon-to-be-iPhone-owner”.

Here is a video showing off some of the apps for the iPhone built in Flash. I’ve already seen people coming out saying that this is a terrible idea, but I think those people are wrong and any questions and concerns they may have will surely be considered and fixed by Adobe.

Portfolio Updated – That’s So Weird

Tuesday, August 25th, 2009

In January, shortly after I returned to work from my Christmas vacation, I was informed by my boss that we had landed a contract with Halifax Film to do some game development and that I would be the guy who would be working on it. This meant two things to me: number 1, I’d be working downtown Halifax, which would prove to be an experience all it’s own, and 2, I would be getting to work in games, my first real chance since the mess that was my first job, but is the reason I had originally gotten into programming.

I’m a big game nut, but I don’t consider myself a “hardcore” gamer by any means. I’ve recently been playing a lot of casual games, and most nights you can find me having a quick match of FIFA09 on the XBox 360, but that’s about it nowadays. Either way, I was pretty excited to get the chance to build some games.

The games were built in Flash and ActionScript 3 and can be played by clicking on this link. You can also check out a write up on my portfolio, though most of that information will be in this post. The games were built for a new show called “That’s So Weird TV” a sketch comedy show aimed at tweens, set to premiere on YTV in Canada later in 2009. I also built a couple of videos players, but this post is all about games, so I’ll get to it.

The first game I worked on was called “Udderly Insane“. In in, you play a receptionist (who happens to be a cow, notice the clever, punny names on all these games), who has to answer phones as they ring, much in the style of the classic “Whack-A-Mole” game. You can also put the phones on hold, and if you manage to have all the phones off the hook at the same time, the cow will freak out, and the user gets to see a great “freak out” animation and a scoring bonus.

Next up was “Monkey Business“. Almost any Flash game site will have a game like this one, where objects drop from the sky at random locations and you have to catch them as they fall. In this game, you’re catching objects as a monkey, with other monkeys sitting in the background on type writers. In the “see-no, hear-no, speak-no evil” theme, each of these monkeys has a different visual attribute, one wearing sunglasses, one listening to headphones and one chewing gum. There’s also another monkey in the background on a chair who is the “head writer” monkey. The idea is that these monkeys are writing the script for the “So Weird” TV show and as you catch objects you inspire the writers to write a better script, making the head writer monkey get more and more excited as he reads what the monkeys are writing. As I mentioned, this game has been made about a thousand times before, but I think the graphics we had (from a great graphics team) really make it stand out.

Next up was a game called “Polar Prima Donnas” and was like nothing I’d ever seen before. When I read the game design doc I thought there was no way it would work as a game (though the “Udderly Insane” we used was the third version I built, and I thought the first one was amazing), but it ended up being my favorite game to play of the bunch. The premise is that you’ve delivered the script the monkeys have written, but the light and camera operators are suddenly sick and it’s up to you to control both. On top of this, the two Polar Bears acting in the sketch are camera hogs, always trying to steal the spotlight from the other one. As you use the mouse and keyboard (arrows or WASD keys) to control the spotlight and camera to focus on the bear talking, you score points by lining everything up. What makes the game fun is that in the middle of one bear talking, the other bear comes out and interrupts him and you have to move the camera and lights to the now-talking bear as the other bear walks off the stage. That bear then walks out somewhere else and the cycle repeats. In addition to this, if you line up the camera and light perfectly, you can press the mouse button down to “globally warm” the bear who is talking. If you manage to heat the bear up the full way (there is a thermometer that shows up and the bear gets more and more “red” and starts sweating profusely) he will “blast off” of the screen and you score a bonus. A very fun game I encourage you to try!

The next game I built was called “Broadcast Gerbillism“. In it, you use the V, B, and N keys on the keyboard to place tubing, trampolines and cannons into a tube based system that “electrogerbils” are running through to deliver the signal to the viewers television sets. The game is very “Lemmings” like, and I really enjoyed building it, not only because I used to love the Lemmings games, but I built what I consider to be a very strong tile-based engine for the game to operate on, and it’s something that I can continue to use in my current projects if need be. There was quite a bit of debate in the making of this game, as many people found it “too hard”. I remember growing up, every game was pretty much impossible (hello, Ninja Turtles for NES), so I was of the belief that the game was not too hard. In the end I didn’t win out, but we did use one of my ideas for the game, and I think it’s probably the best idea (if not the most fun) idea I had. I suggested that when the gerbils “die”, they become ghosts, full with a halo, angel wings and a harp and they float off into heaven. The graphic guys did an awesome job making the gerbils and they turned out great! Definitely an awesome game. Oh! The background track is amazing for this one…

I saved “Cut The Cheese” for last. From the start it seemed like a puzzle game without a lot of direction. I think puzzle games are the hardest things to think up, so I really applaud games like “Bejeweled“, because it’s so simple, but it works. The idea for this game was that you would be cutting together the terrible mess the polar bears made to make a watchable sketch. The game would be something like “Tetris” and a generic puzzle, where you’re trying to fit the appropriate pieces into their corresponding slots. It was a tough game to build, and I won’t lie, it’s tough to play (not the same as “too hard”), but I was only asked to build it. We tried to make it the best we could, I think that if we had more than a couple weeks to build it we really could have had something, but unfortunately this is how programming goes. Don’t know why I saved the negativity to the end.

The only real problems I have with the games are the lack of consistency with the controls (I believe all truly casual games should be mouse only, just something that bothers me) and the instructions could have been done better, but on deadlines, sometimes these things are tough to do.

All in all it was a great experience at Halifax Film, and has allowed me to move on to building more bigger and better games in my everyday job at theRedSpace. Be sure to check my site and follow me on Twitter to keep up and get the news when my next games come out!

Some great Box2D tutorials

Tuesday, August 11th, 2009

As a Flash developer, I’ve always been interested in learning a physics engine. It’s no secret that Box2D is considered one of the best physics engines around for any language, and there is a port to ActionScript 3.

What’s even better are these tutorials, which go over a nice introduction to Box2D in Flash, as well as a great tutorial on how to create a Peggle (another one of my beloved casual games) clone!

Anyway, I thought this was well worth a blog post as these tutorials have really helped me out and I believe they can do the same for others.

Flash Library Symbols in Flex

Monday, June 29th, 2009

Currently I am working on some games for my full time job with theRedSpace. The team I am a part of decided that what would be best is that we go with Flex (now Flash Builder) rather than Flash. Now I am by no means “afraid” of Flex, but as a very visual person I prefer to program in Flash, games especially. The main reason for this of course is because in Flash I have my beloved library where I can build my Movieclips to my heart’s content.

So the problem for me was “how can I use my Flash symbol inside my Flex project easily?”. At first I was thinking about simply loading external assets, but I then would have about 50 or more asset SWFs that I would have been trying to manage, and for me, that just wasn’t an option. I thought next about using the “Embed” meta tag to embed the SWFs and then use the symbol attribute to grab the clip I wanted by simply marking my Movieclip symbol for export into ActionScript in my Flash library. I learned quickly though that this would not be an option as when I bring a clip in through use of the embed tag that my code in the timeline is stripped (I don’t like putting code in the timeline, but for my simple stop() and gotoAndPlay() commands I really don’t mind it).

So I was back to where I started. Luckily I came across a great tutorial online (can’t find the link, but when I do I will post it here) that mentionned using the getDefinition() function to grab symbols from library symbols in Flash. The code is actually very simple. You just load the clip using a normal loader, you then use the getDefinition() function to grab the library object as it’s own class and then create an instance of the class.

Here’s a very quick and dirry example to give the feel:

var loader:Loader = new Loader();
loader.addEventListener(Event.COMPLETE, _loaded);
loader.load("theswf.swf");

function _loaded(e:Event):void
{
var skinClass:Class = e.target.applicationDomain.getDefinition("ElememtClassExportName") as Class;
var clip:MovieClip = new skinClass() as MovieClip;
this.addChild(clip);
}

Of course, here this example assumes that the element you’re trying to load in the is being exported to ActionScript as “ElementClassExportName” which would never happen (or should never, rather).

This little bit of code though is great because it will allow you to have all of your visual assets in a single SWF file that you can load at the start of your Flex application and not have to worry about managing boat loads of SWF asset files. Hope it can help you as it helped me!

Cloning/Copying Objects in AS3

Tuesday, May 12th, 2009

I was recently working on a game that was controlled mostly by arrays (it was a puzzle game). When a user would fail a level I would have to reset the pieces to be back to how they were at the start of a level.

Setting up a function to reset the level just didn’t make sense. I wasn’t completely sure how I could get this done properly. I tried to create a second value that would remain constant in my code that mirrored the original look of the level’s unfinished puzzle and when the user would fail I would just overwrite the current state of the level with the constant version of that level. Obviously due to referencing in flash this didn’t work.

I learned about a function in Flex known as “copy” in the ObjectUtil class that would clone a data object, just as I was trying to do. Linking the Flex classes into the project didn’t make sense for me, so I needed to recreate the function for AS3. I thought it would be difficult but I was able to get some help and ended up with the following:

function clone(source:Object):* {
var copier:ByteArray = new ByteArray();
copier.writeObject(source);
copier.position = 0;
return(copier.readObject());
}

It worked perfectly. I can now copy objects extremely easy in Flash with this clone function. I hope that it will help anyone out there who may need a solution for a similar problem.