Posts tagged as 'Free code'

Object Pool class

Two of the slow operations in the flash player are object creation and garbage collection. If we pool objects – save objects when they’re no longer needed and reuse them later when another object of the same type is required – then object creation is kept to a minimum and garbage collection is reduced to zero…

Actionscript 3 tetris source code

This will certainly be useful to anyone wanting to make a tetris game. It’s probably also useful to anyone learning Actionscript 3, particularly if they want to make games. The source code is on the Flash Game Code web site. It’s in two parts – an engine, which does the game part, and a sample game that uses the engine. Have fun.

Radial Perlin Noise

I was messing around with perlin noise, creating a radial effect for a game I’m working on. The result is a RadialPerlin class for creating radial perlin noise bitmaps. The code is licenced under the MIT license. Have fun, and if you make something interesting with it let me know.

PHP Password Security

If you build websites that require users to register it’s your responsibility to keep their passwords safe. And if you’re storing the passwords in plain text then you’re not doing your job properly. What happens if your database is stolen? It’s not just your site that is compromised. Since most users use the same password on multiple sites, all those sites have also been compromised…

Keyboard polling class – bug fix

There was an error in the Keyboard polling class that I posted yesterday. If you downloaded the class you’ll want the new version, which is available here.

Polling the keyboard in Actionscript 3

Games often need to get the current state of various keys in order to respond to user input. This is not the same as responding to key down and key up events, but is rather a case of discovering if a particular key is currently pressed.

In Actionscript 2 this was a simple matter of calling Key.isDown() with the appropriate key code. But in Actionscript 3 Key.isDown no longer exists and the only intrinsic way to react to the keyboard is via the key up and key down events. To rectify this I created the KeyPoll class…

Events in Actionscript 3

There was lots of positive feedback to yesterday’s post about my Actionscript 2 event class, so I decided to create an Actionscript 3 version. I added a lot of features while I was at it – listener priorities, preventDefault, stopNotification (aka stopImmediatePropagation), hasListeners, weak references, and to send the event as the single parameter when notifying listeners…

Different types of weak references

Actionscript 3 seems to have two different types of weak references. The difference relates to method closures (or bound methods) and the weak references used by the EventDispatcher and Dictionary classes. Try the following…

next page