Nothing too major to report today. Made a few minor adjustments to the site to change how errors are reported and to fix a few neat errors that bots were throwing my way.
Quick note for any ASP.NET MVC devs out there: if you’re seeing Controller or View not found errors due to requests for robots.txt, then add this code to RegisterRoutes in your Global.aspx:
routes.IgnoreRoute(“robots.txt”);
On the other side of things, I suspect that most of our games will be Flash based and coded in FlashDevelop. FlashDevelop is a pretty awesome free Actionscript IDE, but it doesn’t come with the sort of user controls I like to work with — actually I don’t think it comes with any native support for user controls. I have a long history with Microsoft.NET Framework, which is a beautiful programming environment, but now I’m a bit spoiled when it comes to library API. Enter the NDR custom control library!
In .NET, a developer can create a new Button object, set whatever properties are important at the time, like size, position, text, button click events, and so on. In Actionscript, I feel like every time I write a new game I’m rewriting or branching the same user interface classes and there are short cuts and hacks all over the place. So, in an effort to make reusable and maintainable Actionscript, the NDR control library has been born: it feels more like .NET to me than Flash and it aims to resolve all the annoyances I continually have with using Sprites for user controls — for example, why does text auto-scale in pixel size when you change the width of a text field? Oy. Anyway, I might make this available for download in the future but it’s still in development for now.
There are two controls so far: Button and Label. The Button control supports flat and 3d rendering, and the 3d rendering will depress on mouse events. The Label control… well… is a label control: text, color, alignment and presto. A label.
Here’s a code snippet that built some of the controls in the above image:
var b4:Button = new Button();
b4.width = 175;
b4.y = 75;
this.addChild(b4.display);var b5:Button = new Button();
b5.width = 100;
b5.x = 200;
b5.backcolor = 0xff0000;
b5.color = 0xffffff;
this.addChild(b5.display);
As you can see, I’m using the Composite / Facade / Proxy pattern. Button and Label are both “POAO” objects — plain old actionscript objects, but they have a DisplayObject they provide to be added to the stage. It’s a bit annoying to require that the display property be specified in addChild(), but I think eventually there might be a Form class that’s a child of DisplayObjectContainer, and then it to can have happy helper methods!
Anyway, tomorrow night, these Button control needs to support images for different mouse states, then it’s time to make a new game for learning hiragana!
