Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
I conclude this tutorial. with a review of ActionScript for controlling and manipulating information to create more complex interactivity, including simple Flash games. Our final project will use combinations of the scripts covered in this section of the tutorial to create a simple interactive Flash game. Let's have a look at some examples of the kind of games you can create by applying the scripts I'll be covering here. Look for a games folder inside the Work Files folder and open up the three files that you see there. Let's go ahead and look first at Space Mission I, this minatogawa final file. Do a Control, Test Movie and you can read through the instructions here. Notice that there's some music playing. Reach your docking station, click start. There's a level setting. Let's start with Easy. Use the left and right arrow keys. This is the most simple game that I'll show you just using two keys and the idea is to - no speed control, just direction - is to reach the space dock there. Medium level, a little bit harder. If you run into any of the objects or if you run into the earth here, I guess if you - yeah, if you run into one of the objects there, game is over. Let's go ahead and close this movie down. Have a look at the next one here, the carver final. A little bit different. This is Lady Bug. The object here is to grab as many hearts as you can while avoiding the spiders. Turning left and right. This has additional controls, up and down, to speed up and slow down. You can also press the P button to pause the game. Let's go ahead and Control, Test Movie this one. This one also has a volume control here with a slider that we've covered earlier, as well as a mute button. If I click on Play notice that there's a Time Elapsed value up there. This one's a little bit hard to get started. There's a bug here for getting the Lady Bug started but it will eventually get started by clicking on the Up arrow and I'm clicking on the Left and the Right arrows to navigate my lady bug and try to hit as many hearts as I can. The hearts disappear when you roll over them, or run over them. I can Speed Up and Slow Down by hitting the Up and Down arrow keys. Notice that each time that I run over a spider the spider doesn't do anything but it will decrease my lives. Here I have two lives. Also, I don't run off the Stage I just move from one end to the other. Let's slow this down a little bit and change direction, slow this down by clicking on the Down arrow and now rotate this, go backwards and once you get all the hearts you will win the game. I believe - if I remember correctly. There's the last heart, yeah. Game Over, press the Spacebar to continue and again, the only problem maybe with this one is that when you do run over the spiders nothing happens but when you run out of lives, Game Over and then it gives you your score. So, quite a nice little game; entertaining game. Probably the best way to inspect the scripts in an unfamiliar file like these is to use the Movie Explorer. Go Window, Movie Explorer in the middle of the menu. This will give you some controls up top for looking at text, movie clips. Click on the one for showing ActionScript and all the actions here are in frame 1 of the main timeline so I have all the variables are being established, start time, finish time, current time, elapsed time. Here are variables for spider hits, heart hits, score, Array variables here. Then I have heartbeat section, verify the current state of what's needed. Here's a section: menu equals 1, playing equals 2, paused equals 3, end level equals 4 for the mode here, so here's the start conditions. There's the function for the EventListener. Here's the playing section. Here's the clear message. Here's a conditional for making the spiders and hearts appear or disappear, I think. Here's a function for Mode 2, the EventListener for that, checking your initials, moving of the bug, showing the time and so on. So everything's kind of divided up here by mode. Here's the next level. Here's the section for showing the menu. Here's a function for adding the addChild method, will add this menu movie clip and the play movie clip to the stage here. Here's the close menu. Here's the restarting time function, pausing the time, showing the time, again, so you can see this is quite involved, but everything is pretty well labeled. Here's the function for hiding stuff, showing stuff, function for unpausing, function for moving using keyboard controls and so on. The spider and the hearts, perhaps reassigning them on the Stage. So, quite involved but very well documented using many of the scripts that we've covered previously. Here's a conditional statement, general functions, there's some collision functions and some timer and some random methods that I'll be covering in this section, but let's go and look at the last example. Jacobsen is a bit more complex. Control, Test Movie and nice intro, more detailed explanations here of things to avoid, how to score points, here there's a timer to count down the play. The idea here is destroy these asteroids before they can reach the earth and using the Up arrows and Forward and Back arrows. More controls available for this one. This one's very hard to win. Notice that if you miss any of the asteroids or if you hit one of the satellites the game will be over. Also there's a nice animation when the asteroid hits the earth. This one will probably keep you entertained for a while. I've never been able to actually win this one. Let me show you one more collision state. If I run into any of these satellites without my shield, ah, I wasn't able to hit that again. But if you hit a satellite there it'll cause the game to be over. Again, what you'll want to do is open up the Movie Explorer to see these scripts. These are located in different locations, separate locations. Here's actions for the Play button, Play Again button, Start button; actions for the Boost movie clip, Asteroid movie clip. Here's variables that we're declaring. If-then conditional statements, here's a function for the ship movie clip. Also EventListeners for the various keyboard Up arrow, Down arrow, Left arrow, Right arrow. If key is down and the key is the left arrow then set the speed to this. If this conditional is met set the speed to that and so on. So there's quite a treasure trove of scripts here to study and learn including the random number generator, the collision detection, scripts for detecting which key has been pressed and then what to do when it detects that keypress. And he's divided up quite nicely based on movie clips. There's the shield movie clip, the jam movie clip, the cloak movie clip - this is a way of adding interest and complexity to the project after you get the bare bones project working, is to kind of add more movie clips and then add some more actions related to that movie clip. Now the Flash Math Class will be an important part of the work in creating our game, so let's now move on to the next movie and start our discussion on how to add increased interactivity by reviewing the various members of the Flash Math Class.
| Course: | Adobe Flash ActionScript 3.0 for Designers |
| Author: | James Gonzalez |
| SKU: | 34060 |
| ISBN: | 1-935320-82-3 |
| Release Date: | 2009-11-09 |
| Duration: | 9.5 hrs / 101 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |