Prologue — still can’t beat the deadline

Sorry world, the prologue will have to wait. Still squashing some bugs and adding more features (feature creep alert!)

I’m going home for a few days and  my hometown is poor so I won’t have internets there.

Anyway here’s a screenshot of people laughing at my failure to meet a deadline:

Advertisements

Getting to know the Tiled map editor

I came across this tutorial on parsing .tmx maps into AS3. While I find it useful enough to get me started there are still other parts I had to figure out myself.

Using multiple tilesets

When using multiple tilesets additional <tileset> nodes are added to the .tmx file. This means we need to register listeners to each of the images and track when all of them have finished loading. In my case, I implemented a flag on my “onLoaded” function that triggers only when all the images are fully loaded.

Only when the images are fully loaded can you start the actual render process. Else you might end up with a null bitmapdata.

Using the firstgid attribute.

Each <tileset> has an attribute called firstgid. It simply tells the gid of the first element of the tileset. So if you have two tilesets one has firstgid = “1” and the other has firstgid=”301”, the tiles with gids from 1 – 300 are located on the first tileset and >=301 on the second tileset.

two tilesheets

CSV layer parsing

It is possible to specify other encryption methods but I have only tried XML and CSV. Parsing XML layers can freeze the flash player especially on large maps. The CSV layer can be treated as a String so parsing it is only a matter of using split() operations.

Jollibug now with parallax

My friend is making a game called Jollibug. He made it during the Global Game Jam. It isn’t about a certain fastfood mascot — although I personally believe otherwise. He forced me at gunpoint to upload some updates of his game in my blog.

Any resemblance is coincidental

He said he put some parallaxing on the layered backgrounds now. He also made  a totally original menu screen because his game didn’t have any!!! WTF!

Things that are on the works:

  • Animate menuscreen
  • Add warnings or signals on where the enemies come from
  • Sound (sounds halfass right now)
  • Add more corporate advertising
  • Game over screen looks like it was made by a jologs
  • Audience animation states

I think making parody games is for those who don’t have creativity but have an immature sense of humor.

How to use flashvars in as3

I use flashvars heavily to create customizable swfs. After some time I got tired of copy pasting my code and found this:

[as3]
function getFlashVars():Object {
return Object(LoaderInfo(this.loaderInfo).parameters);
}
[/as3]

I only need to call this method (which returns an object) and chain it with the flashvar I want. This only works on timeline code though.

Here’s how I use it:

[as3]
strXMLPath = getFlashVars().xmlPath || "slideshow.xml";
[/as3]

The || is for error handling. If I can’t get the flashvar:xmlPath, I created a default file slideshow.xml to show default data.