Flytrap

Someone re-linked a blast from the past on Reddit yesterday:
http://forums.tigsource.com/index.php?topic=9905.0

It boils down to a guy who put $10,000 of his Grandpa’s money into creating a terrible game. The icing on the cake however, is the guys inability to take criticism and his militant ego. Extra points for where he compares himself to Miyamoto.

It inspired me to create a 2600 Demake of his game that you can play here:
http://squarecircleco.com/flytrap/

Posted in Games | Leave a comment

Fun with \0

I came across an interesting bug the other day, mxmlc started complaining loudly about a newly created string definition. My first instinct when I get weird compiler errors like this is to simply comment out the line and make sure the compiler error wasn’t created because of a dangling bracket. To my horror the newly converted comment was creating a compiler error!

To cut a long story short, if you copy text out of a textField inside the Flash CS5 IDE (Mac) and paste it into Flash Builder, you will copy out the trailing null character! What is even more fun, is that it is invisible in Flash Builder, the only way you can tell it is there is because navigating across it will swallow one key press. Luckily Vim shows the null character as an obvious ^@ character.

Finding a way to prank someone with this knowledge is an exercise I will leave to you, but I have a few ideas myself. :)

Posted in Gotchas | Leave a comment

Site Banner

I thought I’d do a quick explanation on how the small banner on this site works, I think it’s a nice effect and it is built on one extremely simple principal.

The banner has five trails, one of them is randomly selected as red and each has an increasing alpha from 0.1 -> 0.5. They are all positioned randomly in squares that are equally positioned across the banner.

The random movement is quite simple, each trail does not have a position, they have a pivot point. The trail draws itself based on a rotation direction and radius.

Each trail has a random time that it will draw for. After that time it will select a new pivot and radius that will continue the line in a smooth arc. This new pivot point can never be outside of the view area, this way the line will never wander off the screeen.

The trail then sets it’s pivot point and reverses its drawing direction and starts all over again!

That is all there is to it really, the lines also choose a random time to ‘splat’ a small circle around themselves and I draw everything to bitmapData for speed. I could have implemented the trails as points that turn instead of the pivot/radius method, but it would not have been as trivial to keep them inside the view area.

Posted in Effects | Leave a comment

Bitmap Smoothing and PixelSnapping

I do a lot of things with Bitmap‘s, especially reusing a single Bitmap object and updating its bitmapData. I was in the middle of some UI work and was baffled to why some of my Bitmap‘s were smooth and some were not after setting smoothing to true. I noticed that if you change the bitmapData property, the Bitmap will lose its smoothing and pixelSnapping values for no reason! Fortunately there’s an obvious fix:

var smoothing:Boolean = bitmap.smoothing;
var pixelSnapping:String = bitmap.pixelSnapping;

bitmap.bitmapData = bitmapData;
bitmap.smoothing = smoothing;
bitmap.pixelSnapping = pixelSnapping;

Hopefully someone updates the API to reflect this little gotcha.

Posted in Gotchas | 2 Comments