The web site for Flash ActionScript 3.0 game developers

 
         
   

ActionScript 3.0 Game Programming

Classpath setting problems

I'm have problems getting multiple .as files to compile. My "main" .as file (the one designated in the Document Class entry in the Properties box) compiles fine but no other .as file compiles. I've read the help files and have added the classpath for the files in the file->publish settings of my fla. Any thoughts on what I am doing wrong?

Naming an object with a string

Hi,

I'd like to create an object with a particular name (which I loaded from a file).

For example,

let's assume I get the string "tree".

I would like to create an object of type 'Car' and call the object "tree".

So that then I can access it using 'this["tree"]'.

If you don't understand please ask.

Thanks

Platform Game Question

When I change the PlatformGame.fla Publish - Player from Flash Player 9 to Flash Player 10, I am forced to click in the game screen after clicking start in order have the keyboard control the character. Any ideas?

Thanks

Dynamic Filter Effects

I have just watched your tutorial on applying Dynamic Filter Effects.

Is it possible to apply the same filter to more than 1 mc, for example 2 circles?

Thanks,

Jay

Including a game swf file in a new Flash project

I gotten some of the games completed from the book and I'd like to include them in my flash based website. When I try to import the swf files, it doesn't seem to work. Is there a better way to get the swf files to work in a different flash project or should I merge the game code into my flash site code? Thanks!

Key codes

Hi,

I'm having trouble with the keycodes
In the flash help files it gives a list of the keycodes and it says that the codes for lowercase letters are the same as for uppercase, i.e. Z = 90 and z = 90. But when you try this it isn't true, 90 only works when you press Shift+z (Z).

So where can I find the codes for lowercase letters?

Thanks in advance

Control existing content on stage

This is probably a real no brainer for you guys but I‘ve been trying now for a couple of days to work this out and …well here I am!

All I want to do is control “existing” assets on the stage from an ActionScript file. I can do pretty much everything by putting my code directly on a frame but as soon as I try to put the same code in an action script file it comes up with a barrage of errors.

I’ve been following the examples in the book and have been able to get them working but they all seam to be adding the content dynamically. I just want to control what’s already on the stage.

Improved Jumping in Platform Game

Hi,

So I've altered the platform game so the hero has some acceleration when he runs, now I want to modify the jump to make it a bit more controllable.

I want to make it like the Mario game so that the longer you hold the jump key, the higher the jump, up to a certain point.

Has anyone modified the game to do this? Or does anyone have any hints or tips?
Any help would be greatly appreciated.

Thanks

Wilbo

Arrow keys don't respond with browser Opera

When using the keyboard (left,right,up,down arrow keys), and you test in Opera 9.2 or 9.27 on a mac or pc, the game stops responding to keyboard input. IE, Firefox and Safari are all fine.

A good sample is the supplied airraid game in chapter 5. If you open the html file with opera, the program stops responding to the arrow keys.

Any thoughts?

Acceleration in the Platform Game

Hi,

I'm trying to change the platform game so that the hero accelerates up to speed and then decelerates down, like the in the old Mario games.

This is what I've got so far:

if (char.moveLeft) {
//walk left
speed -= acceleration*timeDiff;
horizontalChange = speed;
if (horizontalChange < -5) horizontalChange = -5;
newAnimState = "walk";
newDirection = -1;
} else if (char.moveRight) {
//walk right
speed += acceleration*timeDiff;
horizontalChange = speed;
if (horizontalChange > 5) horizontalChange = 5;
newAnimState = "walk";
newDirection = 1;

// no arrow pressed, i.e. key released, so decelerate to a stop
} else if (speed > 0) { //if moving right
speed -= deceleration*timeDiff;
horizontalChange = speed;
newAnimState = "walk";
if (speed < 0) speed = 0;
} else if (speed < 0) { //if moving left
speed += deceleration*timeDiff;
horizontalChange = speed;
newAnimState = "walk";
if (speed > 0) speed = 0;
}

which I took from the Racing Game.
So this works ok. You can run along and then when you release the key, the hero decelerates to a stop.
But I can't work how to do the next bit.
I want to make it so if the player suddenly changes direction, the hero skids to a stop like in the Mario games.
At the moment the hero travels quite a long way when turning around, the effect being as if running on ice!

I'm sure that this is one of the first things people add to the platform game, so I was wondering if anyone's already done this, or could give me some hints as to how they think it's done.

Thanks in Advance,

Wilbo

Syndicate content

Copyright Gary Rosenzweig