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 , , ,


Sprite Inspiration

My artistic skills are bunk. Sometimes, I don’t even know where to begin. So, I whipped up a little Flash image viewer that displays some interesting 16×16 NES sprites for inspiration. Check it out at http://nathandemick.com/flash/tilespiration/.

No comments · Written by Nathan at 8:30 am · Tags , ,


Armada

So I finally decided to be “done” with this little shooting game I’ve been working on for a while. It’s called “Armada.” The goal is to destroy 1,000 enemies. Whenever you kill one, another one jumps on the screen to take its place. However, the more enemies you kill, the faster your ship moves and shoots. Check it out on Kongregate.

One thing I’ve learned about myself during its development is that I can get really bogged down working on more than one thing at a time. My personal programming time is so limited that having two active projects slows things down considerably. Plus, if a project takes too long, I lose motivation pretty quickly. When waking up early in the morning, one has to be excited about what one is doing (an aside: tips for waking up early).

No comments · Written by Nathan at 11:51 am · Tags , , ,


wonderfl

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 , , , ,


Animation in Actionscript 3

I think one of the main disadvantages of using the Flex compiler to create Flash programs is that animation is a bit more difficult to create (although, to tell the truth, I’ve never used the Flash IDE enough to be able to compare them). I think for most simple games, you can get away with not animating any of your characters. But once you get into creating games that have more detailed characters, you pretty much need to add some sort of animation. We can do that pretty easily by loading multiple images into a DisplayObjectContainer (such as a Sprite) and then showing/hiding each image in turn. Take a look at the following example:

package {
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.utils.getTimer;	// for getTimer()

  // Set SWF FPS, etc.
  [SWF(frameRate='30', width='200', height='200', backgroundColor='0xffffff')]

  public class AnimationExample extends Sprite {

    // For frame rate info
    public var ticks:Number = 0;
    public var framesPerSecond:Number;
    public var frameTimer:Number = 0;
    public var currentAnimationFrame:int = 0;

    // For animation
    [Embed(source="run-1.svg")]
    public var animationFrame1:Class;
    [Embed(source="run-2.svg")]
    public var animationFrame2:Class;
    [Embed(source="run-3.svg")]
    public var animationFrame3:Class;

    public var character:Sprite;

    public function AnimationExample():void {

      // Create new sprite for animation frames
      character = new Sprite();

      // Add frames, hide all but the first one
      character.addChild(new animationFrame1());
      character.addChild(new animationFrame2());
      character.addChild(new animationFrame3());
      character.getChildAt(1).visible = false;
      character.getChildAt(2).visible = false;

      this.addChild(character);

      // This will call the animation function
      this.addEventListener(Event.ENTER_FRAME, enterFrame);
    }

    public function enterFrame(e:Event = null):void {
      // getTimer() provides # of ms since Flash Player started
      var currentTicks:Number = getTimer();

      // Figure out how many seconds each frame is displaying for
      var secondsPerFrame:Number = (currentTicks - ticks) / 1000;

      // For the heck of it, you can also determine FPS
      framesPerSecond = 1 / secondsPerFrame;

      // Set this var for the next iteration
      ticks = currentTicks;

      // Increment the timer
      frameTimer += secondsPerFrame;

      // Compare the frameTimer value against the number of seconds you want each frame to display
      if(frameTimer > 0.5) {
        // Reset the frame timer
        frameTimer = 0;

        // Hide the first frame
        this.character.getChildAt(0).visible = false;

        // Move the last frame up to be first
        this.character.setChildIndex(this.character.getChildAt(2), 0);

        // Show the new first frame
        this.character.getChildAt(0).visible = true;
      }
    }
  }
}

Download the code, .swf, and (bad) graphics.

In addition to the setChildIndex() function that swaps the depth of each animation frame, there’s also some code that obtains the current frame rate, which helps set the speed of the animation. In some games, the motion of all the characters can be limited by a number derived by the frame rate, which helps ensure that the game runs the same speed on different computers. This isn’t totally necessary in Flash, however, since it’s possible to limit frame rate by using [SWF(frameRate='XX')] at the beginning of your Actionscript package.

No comments · Written by Nathan at 12:21 pm · Tags , ,


← Newer PostsOlder Posts →