Base code

basecode

This will be the first Ludum Dare where I won’t be using C, and have instead opted for Haxe and NME which, through recent usage, I’ve found quite lovely. It’ll be interesting to see how different this game turns out given I won’t have to deal with some elusive segfault and the 5 hours it takes to track down, or an alignment issue in my bitmap loading.

I’ve written a small amount of base code to cover a few of the most tedious things I imagine I’ll have to deal with. I’ve tried to keep it quite minimal, though, as not to influence any game mechanics/decisions before the competition, leaving me free to try whatever I want — for example, in not wrapping sound handling it leaves me free to code the sound synthesis all from scratch (I did this during LD24/LD25), and in not having collision detection it leaves me free to experiment with different collision techniques. I’ll probably hack away at the base code itself as I go along, and some I probably won’t touch at all.

The base code can be found here and consists of the following:

 

ld.Game

Provides a BitmapData buffer for putting the game’s pixel in. Also handles setting the elapsed time after each frame, and provides update() and draw() functions for overriding. Provides a console for outputting debug stuff.

 
ld.Preloader

A fancy preloader.

 
ld.Tween

The bare essentials for handling tweening.

 
ld.Input

Handles mouse and keyboard input events and provides functions for checking the state of the keys/mouse button and checking whether the keys/mouse was just pressed on this frame or not.

 
ld.Rect

Represents a rectangle. Has inline functions for returning the top/left/bottom/right/middle of the rectangle, which is always useful and makes dealing with rectangles (which I often make ample use of) a lot less tedious.

 
ld.Timer

Handles the delayed calling of function after a number of seconds, or the repeated calling of functions on a timer. This will be something I will rely on for all my timers, which is a deviation from simply using floats which count down to zero on each frame.

 

 

warmup

To test the base code I also wrote a terrible warm up game last night. Play at your own risk:

http://www.ludumdare.com/compo/ludum-dare-27-warmup/?action=preview&uid=16007