Matthew Ammann
Student, Programmer, Flash Enthusiast

Aug
16

What is a PNG? .PNG is a file format for pictures (like JPG). PNGs have good compression and zero loss of image quality. They are the successor to JPGs, and hopefully more and more people will continue to use this format.

You know how .GIF files can be animated so that it looks like the picture is moving? There’s a new format out called APNG (Animated PNG) that will retain the high quality of your images instead of reducing them to a crummy looking 256-color GIF file. Before you get too excited, just keep in mind that it doesn’t have a lot of Application support…yet. As far as Internet browsers are concerned, new versions of Opera and Firefox support it, but Internet Explorer doesn’t. Here’s a more comprehensive list of the applications you can use with APNGs: http://en.wikipedia.org/wiki/APNG#Application_support

You need not worry, however, because APNGs are backwards compatible. If animation is not supported, whatever is on the first frame of your animation will show up as a static PNG image.

What you will need:

1) Mozilla Firefox version 3.0 or higher. Latest version (Currently at version 3.5.2 ) can be found here

2) The APNG Edit addon for Firefox

The editor is a piece of cake to use, and it has all the basic functionality you need to make an APNG. Just add your images one at a time (starting at Frame 1). You can change the amount of time each image displays by clicking on the number near the hourglass at the bottom of each frame. The delay is measured in milliseconds, so a 3 second delay between pictures (i.e. to make a slideshow) would be 3000 milliseconds. Once you’ve finished you animation, click the “Save Animation” button in the top-right, and you’re all done!

Check out the APNG I used as a preview for my Better Kongregate Firefox Addon: https://addons.mozilla.org/en-US/firefox/addon/13677

Aug
15

This script for Kongregate was inspired by, and is based heavily on, arcaneCoder’s Forum Tools script which can be found here. It works a lot like the script’s “Forum Moderator” tag that people in the “Moderators” list are given.

This script is barbaric in comparison, and is simpler to understand than eating cereal with a spoon. To be honest, this is the product of being stuck in the car for 2 hours with no Internet.

Before you install this script, you need to be running Firefox and have the Greasemonkey add-on that can be found here: https://addons.mozilla.org/firefox/addon/748

Without further ado, here’s the Kongregate Staff Identifier Script:
http://userscripts.org/scripts/show/55756

This will also be included in my next update of the Better Kongregate Firefox Add-on

Here’s the thread where you can find more discussion about this script: http://www.kongregate.com/forums/1/topics/53179

Aug
13

Better Kongregate is an add-on I created for Firefox that brings 13 Greasemonkey scripts for Kongregate together in one simple package. You don’t need to know anything about scripting or Greasemonkey to install the add-on and you’ll be able to enable or disable each script as desired. Also, there are links available that will take you right to a description of the script on its webpage at www.userscripts.org. Here’s an animated screenshot (anyone with Firefox 3.0 or higher will be able to see the animation):

There’s a detailed description of all the features and how to use them at the addons link:

https://addons.mozilla.org/en-US/firefox/addon/13677/

Jul
28

I’ve got great news! Robot Saga: Escape is the third most popular game in the Action & Arcade genre on Big Fish Games! It’s got about 7,300 views as of now, and is the 10th most popular online game on the entire site. We had a non-exclusive license agreement that gave me some extra cash in my pocket, as well. Check it out: http://www.bigfishgames.com/online-games/5894/robot-saga/index.html

Here’s a screenshot of my game on the bigfishgames.com homepage…in three places!

robot saga

Jul
27

Kongregate users,

Have you ever wanted to change the color of the AFK (Away From Keyboard) users in Kongregate chat? Now you can. I’ve designed a script, with a lot of help from Ventero, that allows you to change the color of the users that are AFK to whatever color you want using hexadecimal colors. Here’s what you need to do:

1) Get the Greasemonkey extension from Firefox: https://addons.mozilla.org/en-US/firefox/addon/748

2) Install my script by going to the website below.

For more details, and to install this script, go here: http://userscripts.org/scripts/show/54533

Please comment to give me some feedback about the script! You can also post to Kongregate about this script in this thread: http://www.kongregate.com/forums/1/topics/50729

NOTE: This script should also work with Google Chrome (and greasemonkey). Could any Chrome users post here if the script works/doesn’t work for them? Thank you :)

Jul
24

During development of my latest game, Robot Saga: Escape, I created a custom class from scratch that is designed to increase efficency. This class, called SoundObject, is used to manage all the sound functions for my other class files. This allowed me to simply call a SoundObject function from the other classes without having to code all the sound functions into every class. My game is based off of Michael James Williams’ avoider game tutorials, and a few of the variables I use are the same as in his examples. Let’s get started!

Here’s what you need to import:

import flash.display.MovieClip;
import flash.events.Event;
import flash.media.SoundChannel;
import flash.media.SoundTransform;

When making a game, it’s good to think about what features your audience will be looking for. I wanted the player to have the choice of muting the music, sound effects, or both. This calls for creating different Sound Channels. I also like to divide my variables into sections so that they’re easy to refer to. Here’s the first section I created:



VARIABLES



public class SoundObject extends MovieClip {

public var msSoundChannel:SoundChannel;
public var mainSong:MainSong;
public var mainSongTransform:SoundTransform = new SoundTransform(.85);
public var pausePosition:int;

public var mmSoundChannel:SoundChannel;
public var menuMusic:MenuMusic;
public var rolloverSound:RolloverSound;

msSoundChannel is the SoundChannel variable I will use to play the in-game song, mainSong. mainSongTransform is used to simply play the song at 85% volume instead of the default 100%. I did this because I didn’t want the song to completely overpower the sound effects. pausePosition is an integer that we’ll use later on to record the song’s position when the game’s music is muted. mmSoundChannel is is the SoundChannel variable I will use to play the menu music.


public var sfxSoundChannel:SoundChannel;
public var shieldOnSound:ShieldOnSound;
public var levelUpSound:LevelUpSound;

sfxSoundChannel is used for the sound effects in my game. I’ve included a couple of the sounds I used in Robot Saga: Escape as examples.


public var isSfxMuted:Boolean;
public var isMusicMuted:Boolean;

These booleans are crucial to the success of this class! Every sound that’s played only gets played if its boolean is set to false. Wherever you include sound in your games, make sure to check if your game is muted before allowing any sound to play.



FUNCTIONS



public function SoundObject()

{

isMusicMuted = false;
isSfxMuted = false;

mainSong = new MainSong();
shieldOnSound = new ShieldOnSound();
levelUpSound = new LevelUpSound();

menuMusic = new MenuMusic();
rolloverSound = new RolloverSound();

}

This is the code from the SoundObject constructor. It is basically just used to instantiate the variables I already declared above. I’m giving my booleans a value of false, which means that, by default, nothing is muted.


public function playSound(string:String)//not the same as unmute
{

if(string == "main song" && isMusicMuted == false)

{

msSoundChannel = mainSong.play(0,0,mainSongTransform); msSoundChannel.addEventListener(Event.SOUND_COMPLETE, onMainSongFinished, false, 0, true );

}

else if(string == "menu music" && isMusicMuted == false)
{

mmSoundChannel = menuMusic.play();
mmSoundChannel.addEventListener( Event.SOUND_COMPLETE, onMenuMusicFinished, false, 0, true );

}

else if(string == "rolloverSound" && isSfxMuted == false)
{

sfxSoundChannel = rolloverSound.play();

}

}

The playSound function is meant to encompass almost all of the songs you want to play. Instead of creating a custom function for each song, you can just assign a conditional (“if”) statement testing the string that the user inputs as a parameter. As long as you pick easy-to-remember string names, this should replace the hassle of creating (and trying to remember) custom functions for each sound. This code snippet is just an example to use as a template. My actual playSound function involved a lot more sounds!

If you want to loop your song, create an Event Listener like I did for the two above sounds.

Example:


if(DocumentClass.main.soundObject.isSfxMuted == false)
{

soundObjectMainGame.playSound("levelUpSound");

}


public function muteMusic(string:String)
{

isMusicMuted = true;

if(string == "main song")
{

pausePosition = msSoundChannel.position;
msSoundChannel.stop();

}

else if(string == "menu song")
{

mmSoundChannel.stop();

}

}

The muteMusic function applies only to your songs. As I said above, the mmSoundChannel is used solely for these songs. If you want to record the position at which the song was muted, you can use something like the pausePosition integer I created to hold the position of the main song. I didn’t bother with one for main menu, since it’s only a short loop.

Example:

if(menuScreen != null)
{

soundObject.muteMusic("menu song");

}



public function unmuteMusic()
{

isMusicMuted = false;

if(DocumentClass.main.playScreen != null && DocumentClass.main.playScreen.visible == true)
{

msSoundChannel = mainSong.play(pausePosition);

}

if(DocumentClass.main.menuScreen != null)
{

DocumentClass.main.soundObject.playSound("menu music");

}

}

The unmuteMusic function is a bit different than the muteMusic function. It takes no parameters, and it checks to see what screen is currently showing. If it’s the menu screen, it unmutes the menu music. The same applies to the play screen and the main song.


public function stopMenuMusic()
{

mmSoundChannel.stop();

}

This function was made only for the transition from the main menu to the play screen after the user presses “play”. I originally tried using the muteMusic function to stop the menu music on the transition, but it caused a bug, so I recommend creating a “stop” function for music transitions.


public function onMainSongFinished (event:Event):void
{

msSoundChannel = mainSong.play();
msSoundChannel.addEventListener(Event.SOUND_COMPLETE, onMainSongFinished, false, 0, true );

}

public function onMenuMusicFinished( event:Event ):void
{

mmSoundChannel = menuMusic.play();
mmSoundChannel.addEventListener( Event.SOUND_COMPLETE, onMenuMusicFinished, false, 0, true);

}

These functions should be familiar if you followed the avoider game tutorials (link at beginning of post). All these do is loop the music. The functions get called from the event listeners we created in the playSound method. The loop is infinite because, as soon as the song finishes, this method gets called and the song plays again. Since the event listener gets added each time you start the song, the loop will be endless.



That’s it! That’s the end of the SoundObject class. In summary, here’s what you have to do when creating a sound:
1) Add an instance of the sound
2) Instantiate the sound in the constructor (or anywhere you please)
3) Add an “else if” statement to the playSound method.

If you enjoyed this tutorial, please write a quick comment below with some feedback so I’ll know whether I should make more of them. Thank you!

Jul
16

Every developer has to keep things organized. Since I usually have multiple applications going at once, I write things down. These notes can be anything from Known Bugs to ideas about future game features. Here are some of the things I wrote down while developing Robot Saga: Escape:

Development Notes 1

Development Notes 2

Jul
16

Robot Saga: EscapeRobot Saga: Escape is now out! It is the second game I’ve created in Flash, but this time I used Actionscript 3. It is based on the Avoider Game tutorials by Michael James Williams, but it is very much my own creation. It took about 3 weeks to create and another week to debug. I learned a lot about Actionscript 3 programming in the last month, including the fact that it is considerably harder than programming with Actionscript 2. Tell me what you think! Without further ado, here’s the link to my newest game:

http://www.kongregate.com/games/musicdemon/robot-saga-escape

Jul
14

Seeker of TruthSeeker of Truth was the first game I created in Flash. It was made using Actionscript 2, and is based on a program that I did in my Java class. It took me one week (in June of 2009) to create, and involved minimal coding. The game takes in the user’s name and birthdate and attempts to predict their traits. It uses an algorithm based on the “pseudo-science” of Numerology and gives the user a number, from one to nine, that reveals details about their character. In no way do I believe in this 100%, but it yielded some surprisingly truthful results when I input the names and birthdates of some of my friends and family. Feel free to post here with your comments!

http://www.kongregate.com/games/musicdemon/seeker-of-truth

Jul
14