User login |
flashJavaScript proxy for ActionScript 3I find the syntax for calling JavaScript functions from ActionScript to be awkward at best. Consider the following JavaScript: function handleClick(source) { // stuff } var Library = { processOrder: function(itemID, quantity) { // stuff } } The standard way of calling these functions is to use ExternalInterface: ExternalInterface.call("handleClick", "mainPage"); ExternalInterface.call("Library.processOrder", 51829, 3); I find the following syntax to be preferable: JS.window.handleClick("mainPage"); JS.window.Library.processOrder(51829, 3); Source code of the JS class that allows this syntax follows:
4k Dungeon Romp takes 2nd!
Dungeon Romp 4k has taken 2nd place in the Flash 4k Games Competition. I’m pleased with the result and have resolved to buy a 3D Math book with the winnings so I can further the full version along. :)
Dungeon Romp -- full version feedback previewEarlier, you saw my 4k dungeon game. I’ve been working on a “full” version — here’s where it’s at so far. Known bug — walking can get wonky if you’re next to a wall. Dunno what the cause is — it goes away if you run Flash in a debugger. I’m working on it.
Four kilobyte gameHere’s the final version of my 4k game competition entry. This game is a homage to the early dungeon crawlers, like Wizardry, Might and Magic, Bard’s Tale, etc. It’s not quite as fun, but most of my space budget is taken up by Flash bullshit and maze generation unfortunately. Still, you can wander around, kill stuff, and watch various numbers go up, and really, isn’t that what these games are about? Arrow up moves forward, arrow down moves back, arrows left and right rotate you respectively.
o2d -- a two-dimensional game engineThis engine was my senior thesis in school, and a hobby before that. It started out with me wondering if I could reimplement RPG Maker XP in Java, using open-source libraries. Turns out I can, and I did enough of that to satisfy me. Java was too slow (or, more appropriately, I didn’t know enough to write it efficiently in Java), so I ported it to C++. The C++ port done, and a variety of scripting languages embedded and removed, I got bored and starting reimplementing it in a variety of languages as a learning tool. I did Python, Ruby, and later C#/XNA. When I got my first Flash job offer, I decided I needed a portfolio piece, and this engine seemed a good enough choice.
Brevity in conditionalsI see a lot of constructs in code that are just wordier than they need to be. All of these examples are in ActionScript 3, though most of them apply in other languages as well. Many of these are also marginally faster than their wordier counterpart.
Making friends with binary representationThis post is inspired by Nick’s aversion to bitwise operators all over the place. Despite this glaring personality flaw, he’s still worth hiring. Many developers, and unfortunately almost every Flash developer, are far too comfortable with their abstract data types like
Dungeon -- a Flash random dungeon experimentThis is about 8 hours of work, porting Jamis Buck’s dungeon generator from C to AS3. There’s no goal, as this is only an experiment. Apologies to Gauntlet, from which I ripped some quick graphics. The minimap doesn’t show your position, but rest assured it is accurate, and after running around for a few seconds you should be able to extrapolate where you are.
Clone -- a Flash Puzzle gameThis is a game I wrote in about 24 hours total. Mitch from Puny Entertainment did the artwork — those guys are awesome and Mitch doubly so! Get points by making rows or columns of 3 or more clones! The clones are defective and, when matched with their unstable brethren, obliterate eachother and disappear. Get more points by matching bigger groups — a group of 10 with one swap gives ridiculous points, especially on higher levels. Laid-back file loading in AS3This post is in response to Nate, who asked me this question a few days ago. If you load a file using AS3, there are a couple of potential outcomes —
|
Recent blog posts
|
Recent comments
17 weeks 3 days ago
20 weeks 6 days ago
34 weeks 3 days ago
1 year 1 week ago
1 year 3 weeks ago
1 year 5 weeks ago
1 year 7 weeks ago
1 year 22 weeks ago
1 year 26 weeks ago
1 year 28 weeks ago