Latest Posts

  • How do you extract a Sprite back out of a ByteArray?

    I should probably post this into some AS forums (and will do so later), but I had to get this out there quickly and it’s bugging the hell out of me:

    In short, how do you extract a Sprite from a ByteArray? (or any kind of display object for that matter).

    I can write the object just fine, and read it back into a variable, but I’ll be blown if I can then convert that back into what it was originally.

    Here are my attempts so far:

    [as]
    var test:Sprite = new Sprite();
    test.graphics.beginFill(0xff0000);
    test.graphics.drawRect(0,0,64,64);
    test.graphics.endFill();

    //addChild(test); // to test, works fine

    var b:ByteArray = new ByteArray();

    trace(b.length);    //    0 bytes

    b.writeObject(test);

    trace(b.length);    //    754 bytes, so our Sprite is definitely in there

    //    Reset the pointer
    b.position = 0;

    trace(b.position);    //    0 as I’d expect

    var newTest:Sprite;
    //newTest = b.readObject() as Sprite;    //    Ends up being null
    //newTest = Sprite(b.readObject());    // Type Coercion failed error
    //trace(newTest);
    //addChild(newTest);    //    and kaboom, constant “Parameter child must be non-null.” errors :(

    var take2:Object = b.readObject();
    trace(take2);    // ok take2 contains an object, but how can I get the Sprite out of it?

    trace(b.position);    //    754, so it has definitely read it all
    [/as]

    Ummm someone, please help? :)

  • Žene Kese

    The latest and only album soon available

  • (Spoiler!) Play test my 4kb Game Competition entry

    My 4kb Game Competition entry is very nearly finished. I’m in the final “tweaking” stages, trying to get the last few small bugs out, and iron the gameplay a little so it’s less “random” and even more progressive.

    The game is a twitch shooter based (loosley!) on Geometry Wars and requires some pretty mad flying skillz to last more than 30 seconds. The idea is literally to see what kind of score you can get. Here’s a screenie:

    Infinite Ammo

    There are 10 different baddies, “boss waves”, bullet power-ups and particle explosion effects galore! (I went a bit over the top in all honesty). I’d love to have added sound, but I’m pushed to the limit of my 4096 bytes shackles already.

    I know the game isn’t quite as “playable” as it should be, and I’ll work on that in the final few days left before I need to submit to the contest. I also know I don’t have a chance of winning (having seen some of the other entries lined-up!), but it was bloody great fun to code anyway.

    And so as a sneak peak to you here’s the latest beta to play. Comments welcome (but please do bear in mind this whole game had to fit into 4096 bytes, so don’t go requesting anything insane ok?!)

  • Photon Storming onto Twitter

    Ok, so I’m following the pack by getting onto Twitter 2 years late :) I know people call it a “micro blogging” service, but come on guys, face the facts – it’s just internet chat in another guise. Doesn’t make it any less fun though!

    If you’re interested you can find me at http://twitter.com/photonstorm

    I’ve also hooked it into my Beanstalk account, so you’ll get to read my insane commit messagess at 3 in the morning!

  • Flashtros & C64 SID music from AS3/Alchemy

    flashtroI came across a great site called Flashtro. It’s a collection of classic demo scene / warez scene intros and cracktros, recreated in Flash. There are 21 different intros on offer ranging from cracktros such as the Mandala Studio crack by Scoopex, to the “beauty” (*cough*) that is the Pang 100% Trainer by PROJ Inc (coder colours FTW!).

    New intros seem to be released on a semi-regular basis, so I’ll definitely keep this one in my bookmarks and check it out now and again. Perhaps they may even accept some  “guest tro’s” from me? (although I’d rather redo Atari ST demos!) :)

    Here’s a shot from the Scoopex one:

    Scoopex

    C64 SID Music from AS3 / Alchemy

    On a similar retro scene theme I found a brand new C64 SID Chip player written in AS3 by the always inspirational UnitZeroOne. It’s a port of the Linux TinySID library (which is where Alchemy came in) with a minimal front-end interface to show it off. Flash Player 10 is required. Replay quality is great and it weighs in at around 150KB. Sadly the source is not yet released, the usual “it’s a mess, I only threw it together in a few hours” excuse is given :) but I can appreciate that, although I’d still probably sell my Mother for it.

    Now if only I could find the time (and skill) to try and do something similar for an SNDH YM2149 replayer!

More posts to tickle your grey matter ...