Nonogram Madness is effectively done

Seems like the last two projects I’ve done have had kind of lackluster ends. I’ve been sitting on this “mostly complete” project for a while, and while I’m still unsatisfied about certain areas (i.e. there’s no music), if I don’t push it out the door pretty soon it’ll just sit and stagnate. So, here we go: Nonogram Madness.

(If anyone cares, let me know what you think in the comments. The puzzles kinda progress in difficulty, but they haven’t been balanced at all, and some of them are pretty bad. There, you’ve been warned.)

3 comments · Written by Nathan at 8:13 pm · Tags , ,

Nonogram Madness title screen

Nonogram Madness

The “in progress” title screen of Nonogram Madness. Yeah, I decided on a name.

1 comment · Written by Nathan at 2:04 pm · Tags ,

Game Makin': nonograms?

Nonogram game screenshot #1

Makin’ another game! It’s a nonogram game, inspired by Mario’s Picross (read more details about the whole genre at Game Set Watch).

Admittedly, nonograms aren’t for everyone. I enjoy them, however, because they’re simple logic puzzles that have a visual component… they’re more interesting to me than the straight-up numbers of sudoku. When I explained the concept to Chandra, she seemed interested! It’s my goal to make something that she’ll play through =]

1 comment · Written by Nathan at 9:19 am · Tags , , ,


This isn’t exactly news, but I created an account on the Japanese social network/code sharing site Wonderfl. It’s kind of cool… you can use the site to automatically compile Actionscript 3 code, then save it for other people to check out. If you see some code you like, or that sparks a new idea, you can “fork” it — copy it and save your own version. I was kind of surprised… I added two small demos on Monday, and by Wednesday some other users had already modified my demos. There’s a lot of random crap, but you can also learn some cool techniques by browsing through the user-submitted code. If you have any interest in Actionscript, you should check it out.

No comments · Written by Nathan at 1:28 pm · Tags , , , ,

Add an Event Listener in Actionscript 3

Importing graphics into your Flash program is all well and good. You can create movies or animation, but the real interesting thing is taking user input and having your program react to it. The way to do that in Actionscript is to add “Event Listeners” to objects you create. Whenever an event occurs (such as a keypress, mouse movement, or whatever), your Event Listener checks to see if it’s supposed to do anything. If so, then it runs a function with code that you specify. So for example, say the user presses the “left arrow” key. Your keyboard input event handler sees this, and runs appropriate code (in this case, it might move a game character left).

One of the most basic events in Actionscript is the “enter frame” event. This triggers every time the SWF is redrawn, and basically corresponds to the SWF frame rate. In the following example, we’re going to create a new class, and add an “enter frame” event listener to it, so that whenever a new instance of that class is created, a function will run at frame rate.

package {
  import flash.display.Sprite;
  import;  // Required to add event listeners
  // Set our SWF framerate, width, height, and background color
  [SWF(frameRate='30', width='640', height='480', backgroundColor='0xffffff')]

  public class EventListenerExample extends Sprite {

    public var BallGraphic:Class;
      // Variables used to store movement data
      private var dx:int = 5;
      private var dy:int = 5;
    public function EventListenerExample():void
      // Create instance of imported graphic
      var b:Sprite = new BallGraphic();

      // Add to this display object

      // Attach event listener
      // Listen for "ENTER_FRAME" event
      // Run the "enterFrame" function 
      this.addEventListener(Event.ENTER_FRAME, enterFrame);

	public function enterFrame(e:Event):void 
	  // Increment position
	  this.x += this.dx;
	  this.y += this.dy;
	  // If object passes beyond SWF boundaries,
	  // reverse direction
	  if(this.x >= 640 - this.width || this.x <= 0)
	    this.dx *= -1;
	  if(this.y >= 480 - this.height || this.y <= 0)
	    this.dy *= -1;

Save this code in a file named ‘’. You can see that we’ve elaborated a bit on our last example, importing and displaying an SVG graphic. However, this time we add some variables to the class that represent speed (delta-x and delta-y). We attach the event listener by calling this.addEventListener (Event.ENTER_FRAME, enterFrame);. The first argument is the type of event the listener is triggered by, and the second is the name of the function to run when the event is detected.

In the declaration of the ‘enterFrame’ function, we pass it details of the event that triggered it by putting e:Event in the arguments list. The function doesn’t actually use that information, but simply moves our graphic around, bouncing off the “walls” of the SWF. Movement is just one possible application of the ‘enter frame’ event; collision detection can also be calculated this way, among other things.

No comments · Written by Nathan at 2:32 pm · Tags , , ,

Older Posts →