videos

Conquer the Universe With ActionScript 3.0 and the Flixel Game Engine: Part 1

This entry is part 1 of 2 in the series Building a Space Shooter with Flixel and AS3

The Flixel game engine is an opensource ActionScript 3.0 framework written by Adam Atomic. Its aim is to take the donkey work out of building AS3 games, leaving you with all the fun stuff and saving heaps of time!

In this, the first in a series of two screencasts, Shane Johnson takes you through the basics of Flixel, explaining how to build an awesome shoot ‘em up game from scratch.

View Screencast: Section One

Introduction

Get the Flash Player to see this player.

View Screencast: Section Two

Begin Coding

Get the Flash Player to see this player.

View Screencast: Section Three

Moving on; Sprites and Sounds

Get the Flash Player to see this player.

View Screencast: Section Four

Shooting, Killing and Compiling

Get the Flash Player to see this player.

Other parts in this series:Conquer the Universe With ActionScript 3.0 and the Flixel Game Engine: Part 2»

Tags: Videos
Add Comment

Discussion 31 Comments

  1. CX says:

    Year, super old school galaga-stuff!

    I like this retro arcade-shooters.

    COOL!

  2. Ralph says:

    Holy actionscript, batman.

    Good stuff, complicated looking.

  3. The final result of your tutorial is EXCELLENT! Let me try to do it! Congratulations.

  4. Great Tutorial.
    Well explained.. i’m waiting for part II
    thanks

  5. Paul says:

    Great tut and even better that its a video. So much easier to follow than the written ones.

  6. Sk1ppeR says:

    Hmm..without watching the screencasts (i don’t like screencasts much…you can’t skip “to the content” :) ) just by “trying” the demo i’ve noticed a problem with the movement. You can go to only one direction at a time which makes it quite harder to evade the other spaceships. If it is not intentional is it “engine” problem or else ?

    • Hey we wouldn’t want to make the game too easy…….

      The movement of the player is controlled by an ‘else if’ statement meaning only one key can be pressed at a time but this can easily be changed to a simple group of ‘if’ statements like so:

      if(FlxG.kLeft)
      {
      acceleration.x -= drag.x;
      }
      if(FlxG.kRight)
      {
      acceleration.x += drag.x;
      }
      if(FlxG.kUp)
      {
      acceleration.y -= drag.y;
      }
      if(FlxG.kDown)
      {
      acceleration.y += drag.y;
      }

      :D

      • Ben Stanley says:

        This code looks awesome as i would rather have diagonal movement….

        Thanks Shane!

      • Steven Wei says:

        Wouldn’t you rather avoid glitches? if you push up & down at once, it will probably result in a waste of processor arithmetic power! =D

        if(FlxG.kLeft)
        {
        acceleration.x -= drag.x;
        }
        else if(FlxG.kRight)
        {
        acceleration.x += drag.x;
        }
        if (FlxG.kUp)
        {
        acceleration.y -= drag.y;
        }
        else if(FlxG.kDown)
        {
        acceleration.y += drag.y;
        }

        ^ This is prolly really incorrect formatting, but hey, you get the point…

  7. Stan. says:

    I like :D Maybe next time a game about gravity? Like a sort of flying game were you have to make sure that the object stays as long as possible in the air? :)

  8. Jeroen says:

    Nice job, I was looking at the PushButton Engine but this is much more fun. The only thing i found is FTD gives me trouble with mimeTypes of the assets.

  9. tresfx says:

    yeh!!!!
    amazing tut :-))))
    thanksss

  10. Ben Stanley says:

    WOW! This game is awesome……

    I am making a game out of this……

    will post it here once it is finished so everyone can play :)

  11. eathan zoreta says:

    its aweeesooooome!

  12. Jamie says:

    Hi would you be able to link the source code for Flixel at the time you created the tutorial because it does not work with the latest build.

    Thanks

  13. Shane says:

    Hi Yes this was done with flixel 1.25

    you can download it from my server here: httP://ultravisual.co.uk/blog/sourceFiles/flixel_v_1_25.zip

    When I have a chance I’ll up date the source files for this tute to work with the new version on github

    Shane

  14. Jamie says:

    Thank you very much :)

  15. george says:

    it’s not working! When i open the demo page shows only white flash box!

  16. Lucas says:

    Great tutorial thank you !

    I’m trying to find the software “sfx” you are talking about but there are so many softwares called like this and I never find the good one… Could you give me (us) the link?

  17. T says:

    You say in your tutorial that you are creating a game “from scratch” but you’re using flixel… ?

  18. Allan says:

    where the FLA file in source download??
    only action script what about animation and charecters?

  19. Flixel Games says:

    I’ll definitely try. Thank you very much for the tutorial.

  20. Malkierian says:

    A bit old now, but I was trying this (with FlashDevelop). First difference: FD automatically generates a “Main.as” class file in the root of the source folder. When compiling as is, even after making StarShooter and MenuState, it loads a blank flash window.

    Then, when I try to run StarShooter from Main, it gives me this error:

    shoot\src\com\shoot\shoot.as(11): col: 29 Error: The definition of base class FlxGame was not found.
    public class shoot extends FlxGame

    I tried putting the flixel stuff in a folder order that matches its internal packaging, but that didn’t help.

    Any help?

  21. Adrian Gould says:

    Hi Shane –
    great tute mate

    I’m currently hacking the code for later version of Flixel, having a few issues… how are you going on this?

  22. George Lamping says:

    I have found this tutorial very helpful and indeed I have been able to understand the flixel game building process. It would be very nice to see an updated version to take advantage of the newer flixel game version. I have found great difficulty in making this game work using Flash Builder 4.6 as I was not able to find an older version of FDT3 as I am sure this would have made the difference in proper function.

Add a Comment

To add a code snippet to your comment, please wrap your code like so: <pre name="code" class="html">YOUR CODE</pre>. You can replace the class name with "js," "css," "sql," or "php." If there are any "<" or ">" within your code, please search and replace them with: &lt; and &gt; respectively.