Sunday, January 13, 2013

How to embed sounds and music in FlashDevelop AS3 project

Its really easy. Lets have soundfile sound.mp3 in folder music.

        [Embed(source='../music/sound.mp3')]        
        private var musicClass : Class;        
        private var mymusic : Sound;

And then this:

         myMusic = (new musicClass) as Sound;                 
         myMusic.play();

Here is the full sourcecode:

package 
{
   
    public class MusicTest
    {
       
        [Embed(source='../music/sound.mp3')]         
        private var musicClass : Class;         
        private var myMusic : Sound;
       
        public function MusicTest()
        {
            myMusic = (new musicClass) as Sound;         
        }
       
        public function playMusic():void {
            myMusic.play();
        }
       
    }

}

Strange Inspiration

For some time I have this idea - a platformer with flixel. Flixel is really cool game library for flash with lots of cool features (and some small things that I don't like but overall very useful library). So I've started a platformer and here right at the start I met an obstacle. And its a big one. I am not good at drawing. Of course I can buy art or find some free stuff but its not fun like this. I want to do it myself. And I want it to be pixel art. But my pixel art is ugly, I am a developer, not an artist and my knowledge about art is mostly theoretical. (I've read every f**** pixel art tutorial that I've found)
So then I thought - why not an ugly game? With constantly complaining character? I like the idea of game character that don't like the game and so on. Sounds cool, right?
So i decided I'll use 8x8 sprites and I'll make them. Actually they are not that ugly that I thought they would be but anyway they fit the idea.