Making a game with flixel and Flash Builder 4 – Splash Screen

Emanuele Feronato Actionscript 3, Flash, Flex, Game design

Did you read Creation of a game with flixel and Flash Builder 4?

Now it’s time to add a splash screen to the game. The splash screen or the title screen is the first thing the player sees, so we’ll add a backround image as well as the game title.

First, we must change our main file, HelloWorld.as, this way:

As you can see, the only change I made can be found at line 9… here I am calling splash_screen class, that is the brand new class we are going to create.

Here it is:

then PlayState class does not change…

And this is the result:

Follow splash screen instructions to “play”… next time, the game itself

Want to learn more? Learn by example!

Get the full commented source code of an actual commercial cross platform HTML5 game!!

Comments 6

  1. Dude

    I’m using v2.34

    It worked after I replaced:

    public function splash_screen():void

    with

    override public function create():void

  2. markanator13

    I get an error on line 7:
    [Embed(source=”../media/splash.png”)] public var splash_image:Class;

    unable to resolve ‘../media/splash.png’ for transcoding | splash_screen.as | /HelloWorld/src | line 7 | Flex Problem

    any help?
    :D

  3. Mynonas

    using flex 4.5

    had to change line 38 from:

    FlxG.state = new PlayState();

    to:

    FlxG.switchState(new PlayState());

    since FlxG.state changed to read-only.
    works like a charm!

    thanks for the tutorial Emanuele! :)

  4. Ryan

    Great tut, i needed to change

    FlxG.fade.start(0xff000000, 1, on_fade_completed);
    to
    FlxG.fade(0xff000000, 1, on_fade_completed);

    thx all for the previous comments they helped.

Leave a Reply

Your email address will not be published. Required fields are marked *