Go back to Flash Game Development with Flex and ActionScript Related FilesĬreating a platform game with Flixel and Adobe Flex We will build off this code in part 2 of the series to start drawing to the screen. Not terribly exciting I’ll admit, but it is a start. You can then open up the resulting main.swf file in the Flash debug player through File->Open.Īnd the end result? A blank screen that does nothing. To compile the program you need to run the command mxmlc main.mxml from the command prompt. Inside the mx:Script tag we need to add the two functions which match the values for the creationComplete and enterFrame properties. The ] tag just means that any special characters inside the mx:Script tag will be interpreted as text rather than XML characters. The mx:Script tag gives us a place to write some Actionscript code. We will use this to repaint the screen with the next frame of the game. We use this as the entry point in the program.Īttaches a function to be called every time the screen is redrawn. This property just sets a ceiling on what the frame rate could be.Īttaches a function to be called when the Application has been created. Note that just setting the framerate to 100 doesn’t guarantee that the frame rate will always be 100 (or even get anywhere near it). The default is 24, but since we want the game to run as fast as possible it’s best to override this with a much higher number. Specifies a limit on the frames per second. Specify the screen size of the program in pixels. This should look familiar to anyone who has written HTML. These properties can be set through attributes in the mx:Application tag. We start by defining some of the properties of the Application object. This Application object is the entry point of the Flex application, and is the most logical place to start. The top level tag of an MXML file is the mx:Application tag. Note that the MXML file can contain Actionscript code inside an mx:Script tag, but the main focus of the MXML file is to define the user interface. The GUI is created in an MXML file, which is an XML file that contains user interface elements nested in tags very similar to HTML. Creating the ApplicationĬonceptually Flex splits up an average program into two sections: the GUI and the Actionscript code. The graphics used in the game are courtesy of spritelib, which you can download from. With these three tools you are ready to start coding. The debug player will allow you to open up a SWF file directly without having to create a web page to contain it. Finally you will need to download a Flash debug player from. I quite like Textpad, which can be downloaded from. The SDK contains all the tools you will need to compile the source code presented here into a SWF file that can be added to a web page. To get started you will first need to download the Flex 3 SDK from. This article series will step you through the process of creating a 2D Flash game using Flex, with the result being a complete game in the style of the old school top down shooters.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |