Flash_and_Flex_03_2009

On the 'Net •

www.GameInnovator.com - helping you create ‘killer’ games people are dying to play www.Tadimo.com - Network housing various sites, currently under development

0 Score: 0. Select the bottom text object and change the text type to Dynamic Text. Also change the instance name to scoreText . We'll now go onto entering the ActionScript code for the game and adding the alien ships to the stage. Gotothetimelinepanelandselectthetopmost frame (to the right of the Texts layer). With this frame selected, go to theActions panelwhich is by default located around the bottom of the screen. Add the following code. See the code itself for more details on how it works as each part is commented on, see (Listing 1) . We'll now implement the coding and design required for the alien ships. Go to the File menu and select New. Create a new ActionScript file and save it as Alien.as in your Scripts folder. Insert the following code into the file. This code is also commented on in detail, see (Listing 2). Close this script file and open your game's .fla design file. Select the topmost frame once more. Create something on stage that resembles an alien ship. The appearance of the ship can be tailored to your tastes, however I recommend that you keep its size at roughly 65 by 56 pixels. Select the ship, go to the Modify Menu and select Convert to Symbol. Change the name to Alien and the type to Button. Click on the Export for ActionScript check box and set the class to Scripts.Alien . Click on the adjacent green arrow to validate the class definition. This will make sure that a path to the class can be found and that the class found is valid. Remove the object from the stage. The alien object should still remain within the game's Library. Congratulations, you have just finished your first Flash game! Test your game out and see how it works. DAMIEN DAVIDOVIC He has been designing games of all sorts for almost a decade. In the last couple of years He has moved onto Flash as the development platform of choice due to its portability and flexibility. At the moment He is (gradually) building up his own network of sites, with Game Innovator (game design info site) as the current centerpiece. http://www.gameinnovator.com

03/2009 (5)

Made with FlippingBook HTML5