Pausing and Resuming Sound
Submitted by rosenz on Wed, 08/13/2008 - 20:45.Gary Rosenzweig, author of ActionScript 3.0 Game Programming University, shows you how to pause a sound in AS3 by recording the position of the sound before stopping it, then resuming the sound at that same position.
Game Inventory System
Submitted by rosenz on Tue, 07/15/2008 - 17:28.Gary Rosenzweig, author of ActionScript 3.0 Game Programming University, shows you how to create a very simple particle system using a class and by adding and removing movie clips from the display list.
Simple Particle System
Submitted by rosenz on Thu, 06/12/2008 - 17:48.Gary Rosenzweig, author of ActionScript 3.0 Game Programming University, shows you how to create a very simple particle system using a class and by adding and removing movie clips from the display list.
Continuous Animation
Submitted by rosenz on Thu, 05/29/2008 - 18:53.Gary Rosenzweig, author of ActionScript 3.0 Game Programming University, answers a question in this podcast of how to maintain continuous animation while receiving user input. The character on the screen continues to follow a walk animation even while the player triggers the animation over and over.
Multiple Windows with Flash
Submitted by rosenz on Tue, 05/27/2008 - 12:37.Thanks, Sharon
If you want a real OS window, you'll need to look into using a Flash Wrapper application -- something that add functionality to Flash projectors. Search for "flash wrapper" and start looking it different ones.
On the other hand, you can use Movie clips and Loaders to simulate windows inside of a Flash movie. Just make a movie clip that looks like a window, and have that appear on top of everything else. When the user is done with it (OK or Cancel buttons?) then remove it from the stage. You could also add a close button if you like, and even the ability to move the window around around by dragging it from the top. These kinds of things can be quite simple, or very complex, depending on what you want.
Using Bitmap Drawing as a Substitute For Lots of MovieClips.
Submitted by rosenz on Thu, 05/15/2008 - 14:19.Ant wrote:
Your student must be using a lot of movieclips. I've used hundreds, even thousands, of them without seeing a slowdown in AS3. One key is to keep the complexity of these symbols simple. If they are a drop of blood, for instance, select the shape in the symbol and use the Modify, Shape, Optimize function to reduce its complexity. See how simply you can get the shape while still looking good. Also avoid using gradients if you don't have to. Even using cacheAsBitmap isn't as good as actually using a bitmap, so you may want to consider using a bitmap.
On the other hand, instead of using multiple symbols at all, why not have a single bitmap graphic layer that you draw to? Then add the blood to this single layer by using the BitmapData.draw command.
FlashGameU.com Video Tutorial: External Constants From an XML File
Submitted by rosenz on Tue, 05/13/2008 - 22:52.Gary Rosenzweig, author of ActionScript 3.0 Game Programming University, shows you how to read in a small XML file containing some constant variable values.
Not Repeating Items in a List
Submitted by rosenz on Mon, 04/14/2008 - 15:49.Markus Wrote:
This is a pretty common task. If your list is shuffled into a random order, though, then you don't have to worry about it. For instance, if you have 100 words, and then put them in a random order, and then take one word from the list at a time, then you should never end up with the same word twice as you are removing words from the list as you go. The key is to shuffle the array or words, and then remove them as you use them. For an example, see the section "Randomizing the Questions" in chapter 10 of the book.
hitTestObject Not As Expected
Submitted by rosenz on Wed, 04/09/2008 - 17:58.John Writes:
I want to test when the ball is touching the actual movie clip - not the area around it - how do I do that?
You are right. The hitTestObject function just looks at the bounding boxes, not the actual shape of the objects. If you think about it, this makes sense. Can you imagine the complexities of looking at the shape of two Flash display objects and determining if they overlap? Such a function would be very slow, which is why I imagine it doesn't exist. I talk a bit about how hitTestObject and hitTestPoint work in chapter 2, in the section on Collision Detection.
So, to your problem. If the ball is small enough, then you can simply use hitTestPoint with the point being the center of the ball. But if the ball is too large, then you'll need to dig into deeper math to determine when the ball actually touches the side of the rectangle. You can do a Google search on "collision detection circle line" to see some articles on the subject. It is pretty complex if you don't have a background in math.
FlashGameU.com Video Tutorial: Countdown Clock
Submitted by rosenz on Thu, 04/03/2008 - 18:39.Gary Rosenzweig from FlashGameU.com shows you how to build a simple clock to count down time until the end of a game.
Copyright Gary Rosenzweig
