Posts Tagged ‘modules’

  • Advanced Phaser and TypeScript Projects

    This tutorial is a follow-up to the TypeScript with Phaser beginners guide. I will assume you have worked through that tutorial already and have a working set-up in which you can compile Phaser projects. From this base we will expand on the simple approach taken in the beginners guide and show how to structure a more advanced project that benefits from the power of TypeScript.

    Create a new Project

    In the first tutorial everything was hanging off a single app.ts file with one bundled class. This time around we’re going to break it up into more individual classes. In Visual Studio create a new empty TypeScript project, then add the phaser TypeScript definition and JS library files to it as outlined in Step 2 in the first tutorial.

    Download this asset pack and unzip it into the project folder. We’ll reference these files in our code.

    Create a new TypeScript file called Game.ts and add this code to it:

    module Castlevania {
    
        export class Game extends Phaser.Game {
    
            constructor() {
    
                super(800, 600, Phaser.AUTO, 'content', null);
    
                this.state.add('Boot', Boot, false);
                this.state.add('Preloader', Preloader, false);
                this.state.add('MainMenu', MainMenu, false);
                this.state.add('Level1', Level1, false);
    
                this.state.start('Boot');
    
            }
    
        }
    
    } 
    

    Here we have created a new Module called Castlevania under which all of our game classes will live. Obviously you’d change this to whatever your game is actually called, unless you’re genuinely working on a Castlevania game, in which case I’m eternally jealous 🙂

    The Game class is extending Phaser.Game. As a result we need to call super in the constructor and pass in our game settings. Once done we add 4 States to the game: Boot, Preloader, MainMenu and Level1, and then start the Boot state. You don’t have to add ALL of the States at this point, but there is no harm in doing so.

    Read More

  • FlodPro – Awesome Soundtracker Replayer – Sneak Preview

    Christian Corti has been hard at work on the Flod Replay library, and Flod Pro incorporates the latest version and a whole lot more, wrapped up in a sexy ProTracker style interface! He gave me permission to show you a demo of it, so have a play with this:

    [swfobj src=”http://sandbox.photonstorm.com/flod/FlodProSneakPreview.swf” width=”568″ height=”477″]

    Click “Browse” and select a soundtracker module (.mod file) then hit “Play“. Some features work, some don’t. The two sliders on the bottom right are for volume and stereo separation. The numbers 1-4 at the top enable/disable the channels. Clicking through the sample names often reveal hidden messages from the composers 🙂

    Just check out the replay quality! It’s now playing back a lot of mods better than even ModPlug can, all from AS3 / FP10.

    If you don’t have any soundtracker modules to load into it then here is a little zip (655KB) with 5 classic Amiga tunes and the FlodPro SWF. Or you can downloads thousands of tunes from sites like Amiga Music Preservation.