Flash game creation tutorial – part 1

March 14th update: part 5.3 released.
March 3rd update: part 5.2 released.
February 9th update: part 5.1 released.
December 31st update: 5th part released.
December 23rd update: 4th part released.
December 6th update: 3rd part released.
November 18th update: 2nd part released.

This is a quite long tutorial, so I decided to split it in pieces.
It started as a didactic example about flash game creation.

First of all, I got inspiration from Ball Revamped series (do not remember the link, search it on Google), but I’ll add a lot more features. That means more than… two.

Let’s start creating the main character.

The hero

Ok, I said I am going to create the Ball, our hero.

So at the moment our hero will be a red circle with a yellow circle inside. It looks good! Maybe you should print it and keep it on your bedroom wall.

First of all, let’s think about our interaction with the hero. Basically, I want the hero to move when I press a key.

He will move to the left if I press left key, to the right if right key is pressed, and so on.

So the first hero actionscript will be:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
onClipEvent (enterFrame) {
	if (Key.isDown(Key.LEFT)) {
		_x--;
	}
	if (Key.isDown(Key.RIGHT)) {
		_x++;
	}
	if (Key.isDown(Key.UP)) {
		_y--;
	}
	if (Key.isDown(Key.DOWN)) {
		_y++;
	}
}

It’s easy, isn’t it?

The enterFrame event simply checks if a key is pressed, and increases or decreases the hero x or y position according to the key pressed.

Click on the movie and press arrow keys to control the hero, click on “reset” to.. hm.. reset the movie

The Power

Well, you will notice that our hero always moves at a fixed speed.

I want to set up a variable to store the speed, so if I want the hero to move faster/slower I only have to change one value.
This is very important since I am planning to develop different levels where hero speed may vary.

I need to set up a “power” variable to move the hero fastly or slowly.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
onClipEvent (load) {
	power = 3;
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.LEFT)) {
		_x -= power;
	}
	if (Key.isDown(Key.RIGHT)) {
		_x += power;
	}
	if (Key.isDown(Key.UP)) {
		_y -= power;
	}
	if (Key.isDown(Key.DOWN)) {
		_y += power;
	}
}

Now you can change your hero’s speed just adjusting the power variable.
The higher the power value, the fastest the hero movement.

The Speed

That’s quite better than before, but our hero always moves at the same speed, and always starts without moving.

Now I need some kind of acceleration, and eventually some initial speed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
onClipEvent (load) {
	power = 0.2;
	yspeed = 0;
	xspeed = 0;
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.LEFT)) {
		xspeed -= power;
	}
	if (Key.isDown(Key.RIGHT)) {
		xspeed += power;
	}
	if (Key.isDown(Key.UP)) {
		yspeed -= power;
	}
	if (Key.isDown(Key.DOWN)) {
		yspeed += power;
	}
	_y += yspeed;
	_x += xspeed;
}

Notice how I reduced the power from the previous example (3) and this one (0.2).
Now that the power increases the speed, I need to play carefully with it or our hero will move too fast.
I have a yspeed and xspeed values starting at 0, but I can change them to make the hero move as he enters the frame.

Now, the more you press a key, the more your hero gains speed, the harder is to change direction.

Good.

The Fritcion

But now I want a friction, because I do not want the hero to move forever if I don’t press any key.
I want the hero to slowly stop moving if no key is pressed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
onClipEvent (load) {
	power = 0.3;
	yspeed = 0;
	xspeed = 0;
	friction = 0.95;
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.LEFT)) {
		xspeed -= power;
	}
	if (Key.isDown(Key.RIGHT)) {
		xspeed += power;
	}
	if (Key.isDown(Key.UP)) {
		yspeed -= power;
	}
	if (Key.isDown(Key.DOWN)) {
		yspeed += power;
	}
	xspeed *= friction;
	yspeed *= friction;
	_y += yspeed;
	_x += xspeed;
}

So I introduced a friction, minor than 1, that will affect hero’s speed. Now, when I press a key the hero starts moving, but when I release the key the hero will slowly stop. How slowly? The higher the friction (always minor than 1, remember), the slowly our hero will decrease his speed.

The Gravity

I said I wanted to do something similar to Ball Revamped, so I need a gravity. The hero will fall according to gravity strenght.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
onClipEvent (load) {
	power = 0.3;
	yspeed = 0;
	xspeed = 0;
	friction = 0.95;
	gravity = 0.1
}
 
onClipEvent (enterFrame) {
	if (Key.isDown(Key.LEFT)) {
		xspeed -= power;
	}
	if (Key.isDown(Key.RIGHT)) {
		xspeed += power;
	}
	if (Key.isDown(Key.UP)) {
		yspeed -= power;
	}
	if (Key.isDown(Key.DOWN)) {
		yspeed += power;
	}
	xspeed *= friction;
	yspeed += gravity;
	_y += yspeed;
	_x += xspeed;
}

So I replaced the friction with the gravity for vertical movements. If I do not press UP arrow, the hero will fall down. When you read this line, probably the hero has fallen outside of the movie (you’ll see how to prevent this later in the tutorial), so you may need to click on reset to place the hero at the center of the movie.

The Thrust

If I have gravity, I need a thrust. I want to be more complicated to move up since my hero is living in a world where gravity exists.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
onClipEvent (load) {
	power = 0.3;
	yspeed = 0;
	xspeed = 0;
	friction = 0.95;
	gravity = 0.1;
	thrust = 0.75;
}
 
onClipEvent (enterFrame) {
	if (Key.isDown(Key.LEFT)) {
		xspeed -= power;
	}
	if (Key.isDown(Key.RIGHT)) {
		xspeed += power;
	}
	if (Key.isDown(Key.UP)) {
		yspeed -= power*thrust;
	}
	if (Key.isDown(Key.DOWN)) {
		yspeed += power*thrust;
	}
	xspeed *= friction;
	yspeed += gravity;
	_y += yspeed;
	_x += xspeed;
}

As you can see, thrust (again minor than 1) affects the UP movement, making it weaker and more complicated to accomplish

The Wind

What’s now? Sure, the wind!
I want to make the stage look windy, you know, heros’ life is complicate, so that’s it!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
onClipEvent (load) {
	power = 0.3;
	yspeed = 0;
	xspeed = 0;
	friction = 0.95;
	gravity = 0.1;
	thrust = 0.75;
	wind = 0.09;
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.LEFT)) {
		xspeed -= power;
	}
	if (Key.isDown(Key.RIGHT)) {
		xspeed += power;
	}
	if (Key.isDown(Key.UP)) {
		yspeed -= power*thrust;
	}
	if (Key.isDown(Key.DOWN)) {
		yspeed += power*thrust;
	}
	xspeed += wind;
	xspeed *= friction;
	yspeed += gravity;
	_y += yspeed;
	_x += xspeed;
}

Wind affects side movements, if positive will move the hero to the right, if negative will move the hero to the left.
Play with all those variables wisely and find a perfect mix of realism and playability.

The Rotation

Now, the final touch. Just like in Ball Revamped, I want the hero to rotate clockwise when moving to right, and counter clockwise when moving to left.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
onClipEvent (load) {
	power = 0.65;
	yspeed = 0;
	xspeed = 0;
	friction = 0.99;
	gravity = 0.1;
	thrust = 0.75;
	wind = 0.05;
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.LEFT)) {
		xspeed -= power;
	}
	if (Key.isDown(Key.RIGHT)) {
		xspeed += power;
	}
	if (Key.isDown(Key.UP)) {
		yspeed -= power*thrust;
	}
	if (Key.isDown(Key.DOWN)) {
		yspeed += power*thrust;
	}
	xspeed += wind;
	xspeed *= friction;
	yspeed += gravity;
	_y += yspeed;
	_x += xspeed;
	_rotation += xspeed;
}

That’s easy, I only need to se the hero rotation equal to his xspeed.

This is where the first part ends… leave me feedback and tell me what do you think about it.

Here it is a zipped file with all source codes explained in this tutorial.

Continue with the 2nd part

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (194 votes, average: 4.69 out of 5)
Loading ... Loading ...
If you found this post useful, please consider a small donation.
» Flash Templates provided by Template Monster are pre-made web design products developed using Flash technology.
They can be easily customized to meet the unique requirements of your project.

275 Responses to “Flash game creation tutorial – part 1”

  1. qhiiyr on October 30th, 2006 1:35 am

    Great tutorial! I’ve been wanting to learn actionscript, and this is a great introduction to it. One thing though: I think the last flash demo window (when the ball is supposed to rotate) is the same as the first one. Whoops!

  2. santosh maharana on November 3rd, 2006 2:13 pm

    this is a very nice tutorial. becoz this script lets you to control the caracter just like a game.
    thanx to those brillient mind who had given this idea.

    i request you, that Will you please send me some tutorials for aading nice effects to the text alongwith animation only via script not by frame.

    Regards

    santosh maharana
    (web developer)

  3. André Pinto de Oliveira on November 3rd, 2006 4:50 pm

    Hey.. is a cool and easy tutorial… =]

    tks.

    Regards…

  4. Mat on November 10th, 2006 5:34 am

    Pretty neat tutorial, I was looking into flash for some small game creations instead of XNA while I wait to get out of high school and into college. I think i’ll try this one and some others i found.

    Thx,
    Mat

  5. V34 on November 12th, 2006 3:33 am

    Hello, thanks for making this tutorial. But as the first said. The last and the first The both are /downloads/just_move.swf (:

    But i learned alot from these tutorials, and you keep it simple. Thats nice. Thanks alot!

  6. Emanuele Feronato on November 12th, 2006 9:03 pm

    Fixed

  7. morgan on November 13th, 2006 2:07 am

    hey the tutorial really helped me out alot seeing how i started flash just recently

    i have a question though

    how would you stop the ball from moving on contact with a wall or platform or boundary

    i tried to figure it out my self many times and here were my problems

    1.when i hittest the wall i made the xspeed = 0, but the meant that couldent move left off the wall either

    2.i fixed that by saying if (hit test the wall) xspeed = -0.1 which nugged the ball off the wall and let me regain left control again, but the friction property carried the ball threw the wall

    3.then i made it so friction is off and xspeed=0.1 and that works almost perfectly, and i say almost because now what happends is the ball goes a little bit into the wall and then is pushed back out, which works and you barley notice but looks really sloppy

    so could you show me how to use those same physics including gravity but stop on contact with walls and esspecially the ground, im trying to make a little jet pack kinda game

  8. Emanuele Feronato on November 13th, 2006 2:18 am

    Hi morgan,
    I will explain during next days all kind of collision of our hero

  9. morgan on November 13th, 2006 9:10 am

    thanks alot thats good

    because ive been yelling at my computer screen for 2 days now

    great tutorial by the way, the code is simpler than anyone elses ive seen and by far works the best

    and i hope your tutorial covers oddly shaped terrain because if i have to figure it out myslef ill probly rip the screen or my laptop before i figure it out

  10. morgan on November 15th, 2006 6:00 am

    hello

    i tried somthing and i was hoping you could tell me what i did wrong

    i had the wall return a hittestboolean GRAVITYALLOWED=false

    and the code at the bottom of all you have up there inside the ball went like this

    if(gravity allowed=true)
    xspeed*=friction
    yspeed =gravity

    if(gravity allowed =false)
    xspeed*=friction
    yspeed=0

    why does it sink threw a little before stopping!?

    if i drop the ball from high enough at the begining it goes almost all the way threw my little box for the ground
    by the way im really looking forward to more of ur tutorials

  11. Emanuele Feronato on November 15th, 2006 11:28 am

    It depends on how do you check the collision.
    Second part is coming in a few hours…

  12. Conor on November 19th, 2006 7:13 pm

    Why are there errors even though I am copying the actionscript from the tutorial?

    When you draw the ball, how do u make sure that it is the ball that you’re moving?

  13. Emanuele Feronato on November 19th, 2006 8:25 pm

    You should paste the code in the hero istance in the main scene.
    See the source code I provided.

  14. Sphankey on November 24th, 2006 12:16 pm

    Quite cool I must say. But I’m not sure if I need it.

    You’re good man.

  15. Polska Liga Soldat on November 26th, 2006 2:42 pm

    Nice tutorial about basic of physics in 2d world :-)

  16. dhaval on November 29th, 2006 12:51 am

    hi,

    this is really cool tutorial

    but i have littel question

    after i finish this game. it was working fine.

    i solved the problame about the coin out side of wall

    but now my hero is not hitting the coin.

    i try to arrange it with right cliick.

    but some time it goes from the top of the coin, some time beneth the coin.

    it is not hitting the coin.
    can any budy help me please.

    thanks

    dhaval

  17. Yoki on November 30th, 2006 7:05 pm

    such a great tutorial for me… Thanks to the one who made this tutorials… i’ve learned a lot of this…

  18. Sean on December 4th, 2006 4:00 am

    My ball keeps on moving really really fast and i don’t know how to slow it down.

    The tutorial is great

  19. RDFNWY on December 6th, 2006 11:05 pm

    Where do i start from scratch, like what do i do with those script code? Is there a program?

  20. Joshua on December 14th, 2006 12:45 am

    Best tutorial ever. Showing a sample after each step makes everything so much better!

  21. guesswho on December 14th, 2006 4:14 am

    it’s a great strip, but when I did the first step it went just fine.On the second step it din’t change the speed. maybe it’s because I kept ONE action script instead of many, i dont know how to make numerous scripts for one symbol.

    plz help
    thanks in advance,
    guesswho

  22. guesswho on December 14th, 2006 4:18 am

    sorry when I said strip I meant tutorial
    ahhh whoooooops
    ‘.’

  23. CoolGuy on December 14th, 2006 8:29 pm

    so u make the hero then u create an actionscript?

  24. guesswho on December 16th, 2006 1:03 am

    reply to CoolGuy:

    yes. Draw and make the character, then make it a symbol. I find it works better when you make it a movieclip. Click on the hero you made. Open the actionscript and start writing the code.

  25. Sneha on December 16th, 2006 6:25 pm

    Great tutorial!!

  26. alex on December 17th, 2006 6:55 pm

    this has to be the most easiest, fun and more of an understanding that the other tutorials i have read. this has to be the best one ever made

  27. Amen on December 18th, 2006 9:29 pm

    nice tutorial, i like it

    thank you.

  28. Ravikumar on December 19th, 2006 11:16 am

    hi
    I am present learning scripting.
    this is the nice tutorial for me.
    i learn more from this tutorial.

  29. Fire Caller on December 20th, 2006 12:12 am

    This is a 100% great tutorial. I have been looking hard for a game tutorial with immediate results and this is it. Just one problem, when I finish my game, the ball speed is jerky and slow.

  30. Salman on December 24th, 2006 10:20 pm

    Hey it’s a really kewl tutorial. But it only has one problem. You didn’t explain everything very well. Sorry to say that but it’s true. Maybe if you explain everything a little bit more, then more people will come and try to learn from your website. ☺

    ♫♪♫♪♪♫♪♫

  31. Salman on December 24th, 2006 10:25 pm

    how did you even create the ball????

  32. Zach Hill on December 31st, 2006 10:50 am

    I am *trying* to make an extensive flash game or even a full game with my friend. This tutorial you have compiled looks promising, so I will try it. Thank you!

    By the way, I found the Ball Revamped series:
    [http://www.ebaumsworld.com/ballrevamped.html]

  33. Francois on January 4th, 2007 10:23 pm

    Wow great tutorial, one can never learn to much action script. Out of all the game tuts I’ve read up on, this is my favorite.

    Thanks!

  34. yura on January 4th, 2007 10:29 pm

    Hey. Got to tyhe first part but is says i have an error the error is the following=Scene=Scene 1, Layer=hero, Frame=1: Line 1: Clip events are permitted only for movie clip instances.
    see that is the error and my hero wont move so plz email me and tell me what i did wrong???

  35. yura on January 4th, 2007 10:47 pm

    hey never mind i found what i did wrong. i didnt put the hero on moviescript

  36. Justin on January 5th, 2007 7:51 pm

    What was the action script used for the reset button?

  37. Vitor on January 7th, 2007 1:14 am

    Nice tutorial indeed. Simple, easy to understand, simple code and goes direct to the point. Nice work.

  38. ben on January 8th, 2007 1:06 pm

    hi i am in need of a tutorial to help me make a game which involves asking and answering questions

  39. Hugh on January 9th, 2007 11:21 pm

    hey, I just started this tutorial with a high interest in flash, and game design. I thought I should try out this tutorial, and everything was going well up until you asked to put in a variable for the “hero’s” speed. I keep being told that the variable was incorrect and cannot be used until its fixed. I believe that this is caused by my lack of experience in flash. please get back to me, prefferably by email, which I left.

    Thanks,

    Hugh

  40. DocBleach on January 11th, 2007 1:45 pm

    Hi, thanks!
    This tutorial has been really helpfull thanks!

  41. attacklvl98 on January 19th, 2007 8:50 pm

    great man!! i just started flash a.s. and this really helped 1 question though. how do u make the ball rotate the same way of the arrow that you are pushing?

  42. attacklvl98 on January 21st, 2007 9:00 pm

    ok lol maybe my thing didnt make sence…the reason why i am asking is because my ball just keeps a constant rotation no matter what i do..how would i make it rotate in the direction that i push? (is that more clear) lol

  43. flash the hedgehog on February 1st, 2007 3:31 am

    Great tutorial, im getting flash 8 soon, probably. Anyway, this tutorial will probably help me a lot when i get it. Im thinking of making a sonic the hedgehog flash game for my website. MAybe even a sonic battle flash game.

  44. helper monkey on February 2nd, 2007 6:29 pm

    great tutorial!! but one thing i like to add to my games like that is:
    if (_y 400) {
    _y = 0;
    }
    if (_x 550) {
    _x = 0;
    }
    this will make it so that when the hero goes off one side of the screen, he comes back on the other!! =)

  45. helper monkey on February 2nd, 2007 6:33 pm

    sry bout that stupid moderation took half the script out :(
    -attacklvl98,
    all you have to do is put in
    if (Key.isDown(Key.LEFT)) {
    _rotation -= 15;
    }
    then the sme for right, except adding the rotation.
    hope this helps! =)

  46. Zee7 on February 3rd, 2007 10:05 am

    sir i learn your gamming tutorial in flash its realy intresting but here is a little problem and its that you did not put high detail with you tutorial.

    Anyways its realy good i will get many things from your tutorials.

    Sir i hope you know flash coding very well i just want to ask one thing to you that are you only work in gamming i mean do you make flash base wensite……..

    if you will write tutorials on full flash base scripting.then i will be thanksfull to you.

    sir i am webdesigner and currently designing websites in flash but i dont know flash coding very well..

    I hope that you can help me sir i will wait for your new tutorials ..

    Sir i will be thankful to you if you send me tutorials that i require ….

    thanks for readin this message………….please reply me back either you want to help me or not …….please

    With best regards.
    Zee7………….^^

    my email address is zee7_idol@yahoo.com

  47. Zee7 on February 3rd, 2007 10:17 am

    sir i realy want to know about flash scripting and i cant learn this from our country i mean l live in pakistan and i have limited resources at here i mean i cant learn about flash scripting at here…………but i visit you site and i dont know why am i writing these things..

    But my heart i saying that i will get something from you.sir now i am depend on you i mean i will wait for help from you.

    sir i just want to know full flash website coding level.I told you befor that i am currently making full flash sites.

    Please contat me i realy need you help and hope that you will be prove yourself a great leader for me..

    Thanks for reading these messages……….thanks ..thanks

    must reply back ……

  48. attacklvl98 on February 6th, 2007 3:33 pm

    thanks helper monkey that fixed the problem.

    c u guys later

  49. Ian on February 7th, 2007 3:11 pm

    very simple and easy to understand tutorial, great introduction to flash game programming due to the lack of complicated maths

  50. Glucozade on February 12th, 2007 8:32 pm

    my script doesn’t work..when i try it, it says

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Clip events are permitted only for movie clip instances
    onClipEvent (enterFrame) {

    what that about?

    plz help.

    (im hoping to get my skills good enough to make a small but fully playable game)

  51. glucozade on February 12th, 2007 8:53 pm

    im getting the same problem as yura, but i dont know how to turn the hero in to moviescript(?). can anyone please help me?

    PS can i use a sprite from a game instead of the ball?

  52. Glucozade on February 12th, 2007 9:35 pm

    ARGH!!!! im getting frustrated here. my script isnt working:

    **Error** Scene=Scene 1, layer=Sonic, frame=1:Line 1: Clip events are permitted only for movie clip instances
    onClipEvent (enterFrame) {

    Total ActionScript Errors: 1 Reported Errors: 1

    This message always comes up. WHY?!?!!? Somebody plzzzz help me

  53. glucozade on February 13th, 2007 1:30 pm

    Never mind i fixed it somehow

  54. Daniel on February 25th, 2007 12:41 pm

    Great tutorial m8!

    Really helped I changed the ball for a ship but used the same movement code (-wind) as a starship game it works great.

    thanx alot

    Dan
    Graphic Designer

  55. ronald on March 1st, 2007 4:01 pm

    just started with flash and i didnt know anything about it
    thanks to your tutorial i’m starting to get it
    i only think that u should make a part 0.1 to show people where they should put their scripts, because i couldnt find it, anyway thanks for the tutorial .

  56. mario on March 2nd, 2007 1:25 am

    It does not work, because there is no instance attached to the script.

    thanks

  57. mario on March 6th, 2007 7:59 am

    tutorial will not work for me. there is no instance attachment.

  58. Ryke on March 14th, 2007 7:01 am

    Just wondering, what does the thrust do anyway

  59. Fittan on March 15th, 2007 5:47 pm

    action script suck, it never works. i always get up errors all the time

  60. ksk on March 16th, 2007 5:05 pm

    keeps giving me error messages plz help

  61. Kyle Poole on March 22nd, 2007 5:20 pm

    Ok, here is the stupidest question ever, HOW DO I OPEN ACTIONSCRIPT? I cant figure it out, i have a ball, but i cant even see the actionscript window to type that stuff in, or do you not even type it, im totally a newb at this so far, but right now im trying to use flash durings chool, and its slightly difficult so far, so how do i do that? or do you have a tutorial that i can go look at elsewhere? ty!

  62. LRG on March 28th, 2007 1:30 am

    I was wondering how do you change a script to a game that is my problem.

    Also…Nice

  63. shwagman on March 29th, 2007 10:39 am

    was very informative and easy to learn, thanks a ton! you don’t know how happy this has made me!!

  64. radcobra on March 30th, 2007 4:03 pm

    the ball is too fast i tried changing power and thrust but no use and i even change the fps
    would someone tell me what should i do

  65. serkan on March 31st, 2007 10:22 pm

    onClipEvent (load) {
    yspeed = 0;
    xspeed = 0;
    wind = 0.00;
    power = 0.65;
    gravity = 0.1;
    upconstant = 0.75;
    friction = 0.99;
    }
    onClipEvent (enterFrame) {
    if (Key.isDown(Key.65))
    xspeed = xspeed-power;
    }
    if (Key.isDown(Key.68)) {
    xspeed = xspeed power;
    }
    if (Key.isDown(Key.87)) {
    yspeed = yspeed-power*upconstant;
    }
    if (Key.isDown(Key.83) {
    yspeed = yspeed power*upconstant;
    }
    xspeed = (xspeed wind)*friction;
    yspeed = yspeed gravity;
    _y = _y yspeed;
    _x = _x xspeed;
    _rotation = _rotation xspeed;

    if (_root.wall.hitTest(_x, _y, true)) {
    xspeed = 0;
    yspeed = 0;
    _x = 120;
    _y = 120;
    _root.bscore -=2;
    }
    if (_root.coin.hitTest(this.hero_hit)) {
    _root.coin._x = Math.random()*400 50;
    _root.bscore =2;
    }
    }

    as you have seen ı have only changed the keys to a s d w with their codes but ı am getting and he is the error “**Error** Scene=Scene 1, layer=hero2, frame=1:Line 11: ‘)’ or ‘,’ expected
    if (Key.isDown(Key.65))

    **Error** Scene=Scene 1, layer=hero2, frame=1:Line 14: ‘)’ or ‘,’ expected
    if (Key.isDown(Key.68)) {

    **Error** Scene=Scene 1, layer=hero2, frame=1:Line 15: Statement must appear within on/onClipEvent handler
    xspeed = xspeed power;

    **Error** Scene=Scene 1, layer=hero2, frame=1:Line 16: Unexpected ‘}’ encountered
    }

    Total ActionScript Errors: 4 Reported Errors: 4

    any idea why???

  66. R3AP3R on April 3rd, 2007 2:45 am

    i want to learn to make flash games but i understand the html a bit but where do i put the html to get that ball screen wordpad? or another program?

  67. smritii on April 4th, 2007 9:54 am

    hi
    this is great tutorial for game designing
    i found a path and initial start for flash games

  68. sam on April 4th, 2007 3:29 pm

    hey…i was making a car racing game and didn’t need gravity, wind etc.
    so i tried to use the friction code. i put it into my car MC and got this error…

    **Error** Scene=Scene 1, layer=Layer 1, frame=3:Line 1: Statement must appear within on/onClipEvent handler
    1.

    **Error** Scene=Scene 1, layer=Layer 1, frame=3:Line 13: Syntax error.
    7. onClipEvent (enterFrame) {

    Total ActionScript Errors: 2 Reported Errors: 2

    please help me…

    other than that, the tute was good and easy to follow :D

  69. sam on April 4th, 2007 3:58 pm

    also…when my other problem is fixed….it came to me that i would need to put something in to make the finish line determine who wins (p1 or p2)
    and bring up a winner screen…i know sort of about hit test but i would like to be able to make it that you have to do say 3 laps before the win screen comes up…and make it so somebody couldn’t cheat by just reversing straight into the finish line…

    i know that probably didn’t even make sense…oh well please get back to me soon…

    Sam. o_0

  70. Omar G. on April 7th, 2007 4:15 am

    hey do you think you could make a fighting game tut that covvers walk and hiting combos and enemy AI. im tring to make a fighter and i need help on Ai and combos , heck i even need help on making the dang character walk (the animation of him walking). i think you tuts are easier to understand and more detailed which is way im asking, so do you think you can help me out?

    or could you email one to me
    my email’s legean1@hotmail.com

  71. sam on April 7th, 2007 2:06 pm

    hey Omar….this probably wont help and ur probably way better than me at flash anyway…but oh well
    if by the character walking u mean for example when you press right the feet move then this one might help you….http://www.tutorialized.com/tutorial/Walking-Movie-Clip/2422
    look at the source file…and see how there r frames of the walking animation in the moviclip…and in the script it says when you press a key…it plays…if that makes sense i hope it helps…

    this dude hasn’t seemed to reply for a while…i like awesty…try him on…www.awestyproductions.com

  72. Omar G. on April 8th, 2007 1:49 am

    thanks ill check them out

  73. J-Dizzle on April 8th, 2007 11:58 pm

    uummm, how do you open an actionscript thing?

  74. Omar G. on April 9th, 2007 10:25 pm

    if we’re thinking the same thing right click and go to actions thats the actionscript area(you could also click the actions panel on the bottum.)

    if thats not what you mean then i cant help you, sorry.

  75. CBURNS on May 3rd, 2007 6:26 pm

    Hi There

    I get this error :
    __________________________________________

    **Error** Symbol=Symbol 45, layer=Layer 1, frame=1:Line 18: Syntax error.
    0._visible = “0″;

    Total ActionScript Errors: 1 Reported Errors: 1

    __________________________________________

    When my script looks like this :

    onClipEvent (enterFrame)
    {
    if (_parent.entrada == null)
    {
    if (this._xscale

  76. Andreius on May 6th, 2007 2:47 pm

    ive been making a car racing type game, and ive managed designing the levels, made character, added if (Key.isDown(Key. -x-)
    statmentsd to move down and up and ive added rotation for left and right…
    it all works perfect ( no syntax errors)
    but when using up and down keys it uses the default north and south.. i want to know how to get it going forward and back but the way the car is actually facing…

    any help at all highly appreciated

    thx in advanced

  77. Andreius on May 6th, 2007 2:49 pm

    to burns:

    well for us to help you could try showing us line 18

  78. mickyas on May 10th, 2007 8:53 pm

    how do i play the game i made.

  79. mickyas on May 10th, 2007 8:55 pm

    please some1 answer me…

    great tutorial emanuel…
    its totaly awsome!

  80. tom on May 16th, 2007 12:27 pm

    OMFG OMFG OMFG
    I CANNOT GET THIS TO WORK!!!

    AHHHHHHHHHHHHH FAR OUUUUT!
    I keep getting errors… Every tutorial i do i get
    fuking errors!

    **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 1: Statement must appear within on/onClipEvent handler
    1.

    **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 13: Statement must appear within on/onClipEvent handler
    7.

    Total ActionScript Errors: 2 Reported Errors: 2

  81. Elfvision on May 20th, 2007 9:42 am

    thanks alot!
    really nice tutorial!
    i was always searching for a tutorial which would teach me how to make objects move using arrow keys and how to give thrust and etc.
    thanks ALOT!
    really liked this tutorial

  82. Deimox on May 20th, 2007 4:08 pm

    First off all i want to thank you for your amazing tut!
    now my idea is to create a ball whose position is equal to mouse position…but that part is easy (_root.[my object]._y = _root.mouse_y and _root.[my object]._x = _root.mouse_y)

    now i want to have a canon incorporated in the ball that rotates when i press the left and right arrow keys, this part ir already done too (if(Key.isDown(Key.LEFT)){ this._rotation = 10)

    this part is the trouble…
    I dont know how to make it shoot a bullet in the direction wich the cannon is facing…thats were i need your help…

    thx
    Deimox

  83. flashbynight on May 28th, 2007 3:16 am

    Good basic tutorial.

    Flash is a great tool for small-time developers.

  84. Ted on June 5th, 2007 11:35 pm

    the first script isnt working:

    **Error** Scene=Scene 1, layer=Action, frame=5:Line 1: Clip events are permitted only for movie clip instances
    onClipEvent (enterFrame) {

    Total ActionScript Errors: 1 Reported Errors: 1

  85. Scott on June 15th, 2007 6:38 am

    great tutorial! ive been searching google forever trying to find a complete tutorial. although this just has the hero…. its helped me a lot, since i just started flash.

    thanks.

  86. Samus Man on June 19th, 2007 12:21 am

    I have to say–this tutorial is looking optimistic. I’m actually entering a competition in less than 30 days, so I need something like this–complete enough to teach me most of what i’ll need and detailed enough so that I can adapt the concepts to my own engine.

  87. flaming on June 24th, 2007 5:26 am

    I keep getting this error.

    **Error** Symbol=hero, layer=Layer 1, frame=1:Line 1: Clip events are permitted only for movie clip instances
    onClipEvent (enterFrame) {

    Total ActionScript Errors: 1 Reported Errors: 1

    I’ve seen other ppl fix it but didn’t explain how.

    Plz help me.

  88. flaming on June 24th, 2007 5:30 am

    Nvm fixed it by clicking the “hero” tab at the bottom.

  89. flaming on June 24th, 2007 5:48 am

    whenever i test it, it rus slowly and shakes. How do i run it without the shaking?

  90. eggel on June 28th, 2007 12:04 pm

    how do u make the hero a moviescript

  91. Jimmy P on June 28th, 2007 5:40 pm

    Hey, I want to start with saying that this is a great tutorial! I just got Adobe Flash CS3 Proffesional a few days ago. And I want to start making a really simple game, so I was wondering how you put this actionscript, and the character that you’ve created, together to make it move?

  92. Izz on July 6th, 2007 7:45 am

    help please!
    I’m pretty new to flash, and ive got a problem with my flash 8. It used to work fine but and when I drew and object and clicked on it, it would be appear normally with a blew rectangle around it. Now when ever I draw something and select it, it automatically has these dots all over it… kind of like it’s already broken apart (I think that’s the term anyway…).
    Anyway, it’s being a bit restricting. Does anyone know how to fix this

  93. Tim F on July 14th, 2007 7:03 pm

    Great Tutorial

    The last one (rotation).
    It’s very great!!!
    And usefull to make rolling balls like RocoLoco (PSP).

    TF

  94. Dan on July 20th, 2007 12:25 am

    This is a really nice tutorial. But I have a problem. I copy and pasted your script, but my hero still wouldn’t move.

  95. BoJaN on July 20th, 2007 3:03 am

    wow! thank you so much, i’ve been looking for a great tutorial for a long time but all the ones i find start past the basics I usually do coding in
    LSL, a scripting language in an MMO and im out of things to program for it so I wanted to learn somthing different and i’m so happy with this tutorial!! Thanks a bunch!

  96. shirin on July 25th, 2007 7:53 am

    hi, i cant open source codes with flash mx 2004. what to do?

  97. SHINOBI on August 5th, 2007 8:31 am

    I love this tutorial! Thanks so much!

  98. Dreamspeaker on August 8th, 2007 10:18 am

    Where do you get the stuff to make flash games?

  99. nate on September 16th, 2007 2:55 am

    where do i get actionsrcipt at

  100. Joan on September 18th, 2007 1:14 pm

    hey… thanks for this tutorial! really helps…

  101. Lazar on October 5th, 2007 7:24 pm

    Really good tutorial, but I don’t know only one little thing: HOW, TO HELL, WILL I PLAY THIS GAME ON MY COMPUTER? I copied the plain text in *.txt file, but how will I play it?

  102. Lazar on October 6th, 2007 9:14 am

    How, to hell, can I play this game?

  103. s0d4player on October 19th, 2007 6:33 am

    Note to many. If you get this:
    **Error** Symbol=hero, layer=Layer 1, frame=1:Line 1: Clip events are permitted only for movie clip instances
    onClipEvent (enterFrame) {
    your probably putting the actionscript on the frame, not on the movie clip.
    Make sure that you are editing the actionscript on the movie clip.

  104. Thibledorf on October 27th, 2007 6:28 pm

    Hi this is a noobish question but how do I make an action script that dose the same thing as a go to and play command?

    I want to make it so that the hero goes to a different scene when you press one of the directional buttons.

  105. Thibledorf on October 28th, 2007 7:22 pm

    Hi, I figured out the answer to my first question but now I need to know how to make it so the directional keys only function when the oposite key is up.

    Here is an example of what I mean, using codes that for some reason don’t seem to work:

    if (Key.isDown(Key.UP) && Key.isUp (Key.DOWN)) {
    yspeed -= power;
    gotoAndstop(81);

  106. Menno on October 29th, 2007 11:24 am

    Hey guys, just to respond on the refresh button… I searched it for some time too, and found a great solution. This is simulair to the refresh browser button, but now it will only refresh the flash clip.

    on(release){
    loadMovieNum(_root._url.substring(_root._url.lastIndexOf(”/”)+1),0);
    }

  107. picklejoe on November 4th, 2007 8:24 pm

    its cool but never works
    does it work on KoolMoves?

  108. picklejoe on November 4th, 2007 8:28 pm

    what the crap???? it never works! not as a sybmol or/and a movie clip!!!!!!!!!

  109. Trevor on November 6th, 2007 4:34 am

    You guys are awsome i want to make a flash game but i dont know how to so ill just keep playing for right now. You guys are awsome!!!!

  110. mister dunno on November 9th, 2007 7:24 pm

    i got only 1 question what program do in need to make a game like this

  111. stevie on November 11th, 2007 7:07 pm

    how do u make a reset button?

  112. stevie on November 11th, 2007 7:11 pm

    how do ya make a reset button

  113. stevie on November 13th, 2007 8:45 pm

    Macromedia Flash

  114. josh on November 23rd, 2007 8:24 pm

    wat is the name of this program?

  115. josh on November 23rd, 2007 8:25 pm

    oo nvm someone asked that and the answer is above me.. aaha woops

  116. none on November 25th, 2007 10:53 pm

    I have a sprite with a walking animation. if he is moving to the right i want it to play and if he is moving to the left i want it to play backwards, how can i do this?

  117. emanuel on December 1st, 2007 1:18 am

    could u teach me how to make a preloader

  118. Ranyo on December 1st, 2007 7:16 am
  119. Liquid Snake on December 1st, 2007 10:21 pm

    Hello, i need a little help with “Flash”, i wish to start out on the subject, but, i do not know how to get thr right tools for the job, if anyone can help me, it’ll be greatly apretiated

  120. tro95 on December 6th, 2007 1:36 pm

    It was a great tutorial but how do you make it so the gravity doesn’t increase and there is a floor which it WONT bounce on???

    (\___/)
    (=’.'=)
    (”)_(”)

    Meet bunny!!!

  121. Keynes on December 8th, 2007 5:57 pm

    Very nice tutorial. You explain very good! This website I will insert in my favorites one.

    Thank you a lot.

    Keynes from Brazil

  122. Cindy White on December 19th, 2007 11:28 pm

    Is this Zach Hill from Chesapeake? I know Jim and Connie. Are you into designing and do you use Flash and Dreamweaver often. If you like 3D, I found Electric Rain a good tool as well.
    Cindy White (Porch)Patrick’s mom

  123. Joe on December 29th, 2007 11:50 pm

    hi, i just started learning about making your own flash games and am a complete noob

    how do i get started?

  124. Thomas on January 4th, 2008 7:02 am

    To Lazar:

    To use this tutorial, you need a program named Macromedia Flash. Not Notepad.

  125. Nico on January 5th, 2008 1:35 am

    hi,

    I use Adobe Flash CS3 Professional, after a while i figured out that i must make a movieclip of the ball… then i right-clicked it, clicked on ‘actions’, but then it said: “Current selection cannot have actions applied to it”. I also dont see the name of my instance (hero) under “Scene 1″ at the actions tab.

    What am i doing wrong???

  126. Nico on January 5th, 2008 2:44 pm

    I got it already, adobe flash CS3 uses another methode for it.

    Using Macromedia Flash 8 solved my problem.

  127. m on January 6th, 2008 5:56 am

    press F9

  128. Jack on January 6th, 2008 8:38 pm

    Im new to flash games etc…

    I am using Sothink SWF Decompiler program… is that the right program ?

    and i don’t even know how to make the ball so on.. please e-mail me and help :D

    jackwattsme14@msn.com

  129. Adam Ch on January 16th, 2008 6:29 pm

    to nico

    with cs3 u need to clik actionscript 2.

    to jack

    u need to use adobe or macromedia flash.

    to emanuele feronato

    how to do u make it so that left and right rotates but does not move and up is to make it move in the direction it is facing and down is to make it reverse, with a car for example.

  130. bob on January 22nd, 2008 2:05 am

    Hi! First of all, great tutorial!

    I’m trying to make a two player game, one controlled with the arrows and another one with keys W A S D. However, when I type:

    onClipEvent (enterFrame) {
    if (Key.isDown(Key.”a”)) {
    xspeed -= power;
    }
    }

    it doesnt let me use “a” as a key. Please help me, and thank you for the tutorial.

  131. stupid on January 23rd, 2008 6:32 am

    It’s not working! this is what the computer spits out:
    **Error** Symbol=Symbol 1, layer=Layer 1, frame=8:Line 2: Clip events are permitted only for movie clip instances
    onClipEvent (load) {

    **Error** Symbol=Symbol 1, layer=Layer 1, frame=8:Line 10: Clip events are permitted only for movie clip instances
    onClipEvent (enterFrame) {

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on/onClipEvent handler
    1.

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 15: Statement must appear within on/onClipEvent handler
    8.

    **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 17: Statement must appear within on/onClipEvent handler
    9.

    Total ActionScript Errors: 5 Reported Errors: 5

  132. Lemony on February 3rd, 2008 11:07 am

    This is atually the best tutorial i have found, the way it takes you step by step, teaching all the variations makes it really easy to learn. Thanks

  133. Hallucination on February 4th, 2008 11:00 am

    your tutorial is brilliant! the only problem is that i have Flash CS3 and the scripting language is quite different. I’m still failing to even get the ‘hero’ to move when i press the arrow keys, but im pretty dim so im not suprised.

  134. chris p on February 7th, 2008 5:57 pm

    what program is best for this?

  135. Zach Cross on February 18th, 2008 9:26 pm

    I can’t find a site to download ActionScript, I know how to do everything, but I can’t find a place to download it! Send link to me in email please.

  136. wil on February 21st, 2008 9:21 am

    sir thanks for this site we student appreciate your hospitality

  137. wil on February 21st, 2008 9:24 am

    sir can you help me in my project using the software adobe flash, my propose game was cayatting can you help me sir pls reply in my email address.tnx

  138. Chris Valle on March 1st, 2008 6:00 pm

    this tutorial answered some of my questions, easy to follow and good results

    good job ^_^

  139. Tom on March 10th, 2008 7:14 pm

    damn awsome tutorial!!!!
    and the last window does work with me :)

  140. John on March 13th, 2008 2:00 am

    What is the Actionscript for the reset button

    mine keeps giving me an error

  141. Nick on March 22nd, 2008 1:57 am

    Hey, Im a new programmer and heard of your tutorials of flash programming by Jimmyr.com and I dont know how to save it like .swf or .as or .html can you help also how do you program it to have those colors and stuff and what programs do you need.

    Thanks I know im a noob.

  142. GodofWarNL on April 2nd, 2008 9:12 am

    You need to use actionscript 2.0 you use 3.0.

    Greetings,

    GodofWarNL

  143. GodofWarNL on April 2nd, 2008 9:14 am

    You can’t download Actionscript! It’s in included in Flash.

    Greetings,

    GodofWarNL

  144. sam on April 4th, 2008 10:23 am

    how do you stop it going through the ground

  145. Daniel on April 8th, 2008 6:10 am

    how come whenever i try the very first actionscript it says that it is a movie clip, and that it needs to be a mvoie. Pls someone explain

  146. Daniel on April 8th, 2008 6:18 am

    Clip events are permitted only for movie clip instances, thats what it says when i do the first step

  147. gimpydingo on April 10th, 2008 10:11 pm

    OK, so how does the box move diagonal?? When I try to type the code my dot only moves 4 way, not 8. Also what’s the diff in code (I am using CS3).

    You have:

    if (Key.isDown(Key.RIGHT)) {
    _x++;

    I tried that and:

    if (Key.isDown(Key.RIGHT)) {
    this._x++;

    So what’s the deal with 8 way movement??

  148. Maheshwar Debata on April 14th, 2008 12:01 pm

    hi,

    this tutorial is great,

  149. Sander on April 15th, 2008 9:06 am

    Hey, this is how all tutorials should be! Great!!

    I’m experimenting with this code but now I’ve got one question. If I want my hero to stop at ‘Spacebar-hit’ how can I do that?! I set the code

    if (Key.isDown(Key.SPACE)) {
    xspeed = 0;
    yspeed = 0
    }

    It stops but everything stops haha; the hero is rotated to it’s starting position and my whole movie is stopped and I can’t do anything!?

    Have you any ideas for me??

  150. Phil on April 21st, 2008 9:38 pm

    Great tutorial. I finally get flash now!

  151. Manieto on April 25th, 2008 9:21 pm

    Erm probs a pointless question but what software you use for this? =]

  152. Rob on May 2nd, 2008 2:34 am

    Hey, this was an awesome intro into Action Script, me and a Friend are hoping to create a flash game and this was a way better starting point than we could have hoped for! Keep up the aweosme work! :)

  153. Rob on May 2nd, 2008 2:35 am

    Its for action script on the program flash :)

  154. Claire on May 4th, 2008 7:15 pm

    Hey, i was just wondering if you could tell me
    how to make objects solid, so that your mover
    cannot go on top of them? i have to make a game
    where an image has to move around collecting things but isnt allowed to go through anything.

    Thank you

    Claire x

  155. Jestes on May 9th, 2008 5:22 am

    Okay i just saw the 1st 3 things about the “hero” and i still dont understand how to use this Cs3 stuff. Please email me specificly how to do this and help me out. I just got this program like 1 hour ago. jestes.moderator@yahoo.com

    Thanks,
    Jestes

  156. Rajiv Srivastava on May 16th, 2008 1:12 pm

    hi..it’s cool…
    but not given the logic of reset button which is one of the most important part of all game..

  157. Samuel on May 20th, 2008 3:41 pm

    Brilliant tutorial…
    Even better than what my eacher could teach me
    and the best thing is…
    I UNDERSTAND IT!
    I will be creating a version of this in the months to come for my website with a christian slant to it…

    Thanks for the Tutorial,
    Sam

  158. Amy on May 27th, 2008 9:40 pm

    Hi Emanuele!
    I just wanted to say I absolutly love your tutorials Im quite new to AS and these tutorials have definatly helped me. Here’s a few links to a few games I’ve created.
    Mohiko Go Home:
    http://www.newgrounds.com/portal/view/438327
    Toke it man:
    http://www.newgrounds.com/portal/view/441079
    Baseball Blast:
    http://www.newgrounds.com/portal/view/441371

    And theres a new game in the making :D

  159. Amy on May 27th, 2008 9:41 pm

    Hi Emanuele!
    I just wanted to say I absolutly love your tutorials Im quite new to AS and these tutorials have definatly helped me. Here’s a few links to a few games I’ve created.
    Mohiko Go Home:
    http://www.newgrounds.com/portal/view/438327
    Toke it man:
    http://www.newgrounds.com/portal/view/441079
    Baseball Blast:
    http://www.newgrounds.com/portal/view/441371

    And theres a new game in the making :D yay

  160. B_Gwra on June 3rd, 2008 3:32 pm

    sir,
    i want to make a carome game. cud u kindly help me. i m confused how to write actionscript 4 a carome game?

  161. adderrson on June 12th, 2008 12:32 pm

    this tutorial does not work!

  162. will on June 20th, 2008 8:45 pm

    U need to aply the actions to the ball not the frame :P

  163. kamar on June 25th, 2008 9:07 pm

    really its fantastic, a flash biginner can really use this, thank u

    vthanks, wish u good luck

  164. halloichbins on June 30th, 2008 8:37 pm

    I have a question:

    if (Key.isDown(Key.DOWN)) {
    yspeed += power*thrust;

    Why do you also multiply the power by the thrust? It will slow down the gravity.
    But you just want to slow down the power to go up, actually you would have to power up the power because of gravity (if you press down the DOWN-arrow you would have to be faster down than doing nothing [just acting gravity]).
    I think the thrust just belongs to the UP-arrow.

  165. Andy Cook on July 8th, 2008 12:55 am

    @ halloichbins

    He is multiplying the power by the thrust to cut down on the power, not make it easier to go up and try to cancel out gravity. In effect, he is making the power 3/4 of what it should be. You have to multiply it because no matter what the power is, you should only be making it 3/4 as strong every time.

  166. noshun on July 12th, 2008 5:02 am

    OMG thanks I really enjoyed this tutorial! I need AS3 help, as Im a newbie to scripting.

  167. Jason on July 20th, 2008 3:14 am

    Very informative, and less complex than I would have expected

  168. hahahaha on July 22nd, 2008 10:54 pm

    what thing do u download to make games??

  169. james on July 23rd, 2008 8:43 am

    dude u r my hero

    soo many tutorials out there but they make them to confusing urs is nice and simple

    and it actually works

    good job…

  170. Nathan on July 28th, 2008 4:08 am

    Hi Emanuele

    Fantastic site and tutorial!
    But im new to flash so how do you make the code for the reset button???

  171. where on July 28th, 2008 4:09 pm

    where do you put all those action scripts if it is on on flash 8?

  172. Nathan on July 29th, 2008 12:08 am

    reply to where:

    inside the hero movieclip.
    open the actions window.

  173. Tom on August 3rd, 2008 1:44 pm

    simply you can make a script where on the wall you press the left/right arrow to get off.

  174. Tom on August 3rd, 2008 1:50 pm

    flash CS3 proffesional

  175. Tom on August 3rd, 2008 1:51 pm

    That means it can only be a movie clip symbol.

  176. Malboro Jones on September 14th, 2008 10:08 pm

    Hiii awesome tutorial!
    I downloaded the file so I could mess around and change things to help me get a bit more understanding, but when I open it to edit in Flash CS3 I cant find the Actionscript! On what frame or where can I find it?
    Thanks!

  177. Malboro Jones on September 16th, 2008 7:27 pm

    I just noticed this is quite an ancient post :P but anyway, I’m using Action Script 1/2 and The
    onClipEvent(load); won’t work,
    I changed it to

    function moveball() {
    movement code here
    }

    then at the end of the script i put -

    this.onEnterFrame = function() {
    moveball();
    }
    works better for me, the onClipEvent just says clipEvent is only for Movie Clips, strange seeing that I had put it on a Mc…

    Well its there in case anyone has the same problem.

    Im having problems making a border for my game though. I don’t want it to reset when the border is touched I want it to bounce back.
    If anyone can tell me how to do that I will be very happy :) malborojones@hotmail.co.uk

  178. Orangatangx on September 28th, 2008 2:19 am

    I really need help on my game, I made a maze but if I hit a wall, my goal changes its position! Please help me, I can send u the swf so you can see it. Email me please.

  179. VexForge on October 7th, 2008 9:49 pm

    on(release){
    hero._y = 0;
    hero._x = 0;
    }

    Figures thats the reset button script…

  180. Omar EL Masry on October 14th, 2008 11:04 pm

    This is a perfectly designed tutorial … Thanks Really … Five stars indeed

  181. Wortho on October 20th, 2008 1:19 am

    I keep getting the same error message:

    1087: Syntax error: extra characters found after end of program.

    How do I fix this?

  182. Wortho on October 20th, 2008 1:22 am

    By the way the source is

    onClipEvent (load) {

    Wont work.

  183. Beastial Pride on October 26th, 2008 3:42 pm

    if like me you had the problem of making the ball move, first select your ball, right click it and press convert to symbols on the screen that comes up, click on MovieClip on the type section and look about half way down the text box and you will see a box for “export for actionscript” click that, then press ok,

    that seemed to work for me, hope it works for you aswell

    P.S great tutorial but it is very different to the other one im using that is on Kongregate Labs, which is “object oriented” (whatever that means).

  184. Kurt on October 26th, 2008 4:15 pm

    Can you tell us the EXACT steps please… You’re just dumping the code and expecting us to know what to do…

  185. Nathan on October 26th, 2008 6:15 pm

    @Kurt

    This is as easy as it gets, if you still need something that explains everything, I suggest you go back to the basics, and not move on to coding until your comfortable drawing circles and creating movie clips.

  186. Wortho on October 28th, 2008 8:25 am

    Ok, thanks Beastial, but I kind of figured it out after about an hour of hard thinking :D

    For all those who dont know how to do it please do the following steps:

    1) Press new file.
    2) Actionscript 2.0 (Not 3.0)
    3) Make an object. Example, a square.
    4) Click the square, then press [F8] to Convert it to a symbol. You can also right click and convert it there.
    5) Make sure it is a movie clip.
    6) Name it Hero instead of the defalt, Symbol 1.
    7) Apply, then press [F9] after it has been converted to a symbol to bring up where you enter in the actionscript. You can also right click and press actions.
    8) Paste the actionscript.
    9) Ok, then press View (I think, but its in the File, Edit, etc… menus) then press test movie. You should have a moving ball.

    Smiley face.

  187. miki on November 3rd, 2008 7:05 am

    Great tutorials, learn a lot from you, just keep on the good work…

  188. random guy on November 6th, 2008 12:53 am

    Hey, I was wondering what software you used to create the flash game. I’d appriciate it if you could e-mail me a link or a website or something that would help me find it. e-mail me back at esieben@newhorizons.ab.ca

    thanks

  189. fabio on November 6th, 2008 4:32 pm

    thank you emanuele. thanks to this tutorial and some code from the samples in flash I devolped a small game called politic fighters. you can find (and play) it at http://lpnl.altervista.org/web/pf.swf
    It’s open source so if anybody wants to modify it here’s the .fla file:
    http://lpnl.altervista.org/web/pf.zip

  190. Gabe on November 21st, 2008 2:53 pm

    i did all of it axactly as you said.
    but when i tried it out i got a bunch of errors saying that i could only use these actions on a movie clip however my blobby hero thingy already was a movie clip

  191. RikaLucia on November 22nd, 2008 4:56 am

    Thanks, Emanuele.
    Awoke from Kongregate told me about you.
    Your tutorial has helped me with creating a game. Not on AS. But on an easier platform.
    Anyway, thanks.

  192. pleaser espond asap on November 27th, 2008 8:40 pm

    What types of programs do i need to make this?
    Where can i download a free and safe link from

  193. andreas on December 21st, 2008 2:29 pm

    Sooooo goooood. thanks. I love you

  194. Victor on January 7th, 2009 5:28 am

    Yep. Been Looking for a decent actionscript tutorial for days and finally found a diamond in a sea of dog crap. Thanks for the great info. I know how much work they are to put together. If you make more tutorials then I’ll get all weird and try to pin all of my hopes and dreams on you like that weirdo from Pakistan and start asking dumb questions like what programs should I use to make a flash game…

    Seriously the highest quality tut I’ve seen. Please make more if it is possible

  195. neo on January 8th, 2009 7:51 am

    Where do you download the software for this?

  196. The Old Brick on March 8th, 2009 8:00 pm

    Can we take one step back, please?

    What is the development environment that I need to program a Flash game?

    Adobe Flash CS4 Professional? (Retail: $699)

    Is there a more entry-level (i.e. cheaper) version?

    Is there a public-domain version?

    Thanks for your help.

  197. Crueltyinc on March 13th, 2009 3:20 am

    I like it. Only prob is the fact that it’s AS 2.0 with action on the movieclips, but it’s a great intro.

  198. LyokoJames on March 27th, 2009 8:16 am

    where exactly do you write the code though?

  199. damarcus on April 13th, 2009 10:33 am

    i remember doing something like this the first time i ever learned flash 2.0… great work!

  200. Billigflug on April 15th, 2009 12:08 pm

    It’s a great tutorial and it helped me a lot. And it brought back memories, when I was still at school and I had my first programming experiences in Delphi. We also had to program a ball and “played” with it by changing the variables.

  201. mie on April 24th, 2009 10:13 am

    i would like to ask how did you do your reset button?i need the exact actionscript for the game im currently developing right now.it was just a simple clicking game….by the way love your tutorial..

  202. lolo on May 10th, 2009 2:20 am

    hello emmanuele
    this is a nice tutorial but when i make the first step on a new flash doccument it goes wrong, tough i make hero a movie clip.
    i have Flash MX professional 2004 but i cant make an actionscript 2 file in it. is that the problem?

  203. jimmy on May 14th, 2009 8:01 am

    hey, great tutorial, just wondering…
    when the ball is moving, it seems a bit choppy.
    when i raise the “power” factor, it seems to move by that many pixels (ex: power = 4, it moves by 4 pixels)
    could anyone tell me how to make it smoother?
    thnx

  204. Kiran on June 27th, 2009 8:18 pm

    i used this tutorial to create a ‘UFO Joe’ style game and it worked perfectly, thanks so much.

    anyone getting the ‘ only avalabie to movieclip’ stuff:

    select the hero, right click – convert to symbol and choose ‘movieclip’ – you should do this with almost anything you want to code in these kind of tutorials.

  205. Ger on June 29th, 2009 2:42 pm

    I have a question. I drew a ball and I can move it with my cursor but how come it’s slower? Your second example(The one about power) is faster than what i did, and the power on mine is 5. I downloaded your file and it’s as fast as the example in this site, so its not about the computer. Can you help me?

  206. Ger on June 30th, 2009 3:44 pm

    same problem as #203

  207. Tom on July 20th, 2009 9:56 pm

    Hi, this is very cool. I have traveled on so many websites about gaming tutorials. This is the best man. Very useful!!

  208. Dan on August 9th, 2009 1:54 am

    could someone plz help me? I need to make my object rotate as the mouse moves to point at the mouse. is there any way to do this?

  209. Gondai Nathaniel Richard Mgano on August 24th, 2009 5:26 pm

    thanx 4 the great tutorial i was looking some thing similar using actionscript

    Ques:
    is javafx capable of bitting flash

    i love pl/sql , java , netbeans THE ONLY IDE!

    thanx for the tutorial

  210. Moh on August 31st, 2009 1:08 pm

    I have been through this tutorial and take it as my helping hand. I’m trying to build up a race game kind of thing with fps view. Here the object will increase according to my progress. For a flash based game, I took object as your Hero and have given the script which is in your tutorial. The changes are liked opposite. E.g. when I press the UP key the object goes down so that the view is like I’m going ahead. But the problem is that the result is not coming according to my logic. The object is coming closer with increasing of size but it also changed its x position which I don’t want. Any solution will appreciate.

  211. Dark Link on September 27th, 2009 5:09 am

    well i was looking for something mre like a different sprite when you click a buton like click left and plays sprite link move left can u help ????thnx :3

  212. zeus on October 5th, 2009 2:20 am

    these tutorials are great

    I’m already familiar with graphical design and pro at coding, I just needed this kind of reference to tie them together.

    thanks!

  213. nectarinegames on October 9th, 2009 3:45 am

    I would like to do this tutorial in ActionScript 3.

    Thanks for your work Emanuele!

  214. Yaoo on October 10th, 2009 7:17 am

    man, u should be a professor at the university where i study at. Some one like u will be relly usefull.

  215. Yaoo on October 10th, 2009 7:18 am

    i mean college hehe.. i study at college

  216. Steve on October 10th, 2009 6:14 pm

    I was actually planning to buy a book and study more about actionscript, then I found your website!! This is Great, Nice tutorial, easy to understand & very straight forward, keep up the good work !!

  217. Flash Games Master on October 13th, 2009 11:01 pm

    This is great info. I am currently gathering as muc info on flash game creation as i am hopefully going to try to build some of my own.

    I am sure this guide will come in handy at somepoint. You are bookmarked.

  218. Darth on October 18th, 2009 6:22 am

    This is a great tutorial except I have a question about using the rotation method. My movieclip is rotating around a point that seems to be on the outside or corner of the actual image. Is there a way to rotate around the center point?

  219. wild_ocelot on October 27th, 2009 1:16 am

    hi, i have 1 easy and very easy ask, what i need for make all that?

  220. Newbio on November 8th, 2009 5:46 am

    Simple and practical, nice job

  221. daysdarkness on December 13th, 2009 4:14 am

    It’s all great and wonderful to know what to type, but would it be possible for you to explain why you type what you do, so, for example, I could create it myself and not copy and paste?

    e.g.
    why do you do xspeed? what does that do
    What is += mean?
    e.g.

    It’s definitely helpful to see what everything does, though, it would be nice to see what happens for each individual thing.

  222. daysdarkness on December 13th, 2009 4:27 am

    sry to double post, but
    _y–;
    why does that go up?

    I’d guess that it would mean image goes to -oo
    (on y-x grid)
    …….^ Y(+)
    …….|
    …….|
    (-)____|____>X(+)
    …….|
    …….|
    …….|(-)

    So Y++ should go up? I mean X++ goes right(+oo)
    You have it so that Y– goes up

    And is there a z-axis?

  223. mooo on January 2nd, 2010 7:17 am

    what program do you use

  224. zard on January 23rd, 2010 10:44 pm

    How good that there is someone who cares about newbies here is my recomendation another thing i did for the friction effect was
    if(key right is down)
    {
    _x += sp;
    }
    if(sp < 0)
    {
    sp -= friction;
    }
    and the contrary for left i am very surprised how many comments you have thans a lot for making pages for us newbies

  225. Asim on January 24th, 2010 6:42 pm

    SUCH A NICE TUTORIAL I had EVER SEeeENN :)

    but i am converting it to Action Script 3.0 with object Orientation

  226. DannyDaNinja on January 25th, 2010 1:37 pm

    Thanks! This really helped

  227. Smith on January 26th, 2010 1:51 am

    What program I have to use ? flash cs4 ?

Leave a Reply




Trackbacks

  1. Flash game creation tutorial - part 2 at Emanuele Feronato on November 18th, 2006 10:31 pm

    [...] Read the 1st part and you’ll be ready to follow me with the game creation. [...]

  2. Flash game creation tutorial - part 4 at Emanuele Feronato on December 23rd, 2006 6:27 pm

    [...] Read steps 1, 2 and 3 if you’re new to this tutorial, then follow this one. [...]

  3. Flash game creation tutorial - part 5 at Emanuele Feronato on December 31st, 2006 11:24 pm

    [...] Read steps 1,2,3 and 4 and you’re ready. [...]

  4. Flash game creation tutorial - part 6a at Emanuele Feronato on January 24th, 2007 12:36 pm

    [...] First, if you haven’t done it yet, read all steps from 1st to 5th, then here we go. [...]

  5. Skylog » Blog Archive » links for 2007-02-02 on February 2nd, 2007 8:22 am

    [...] Flash game creation tutorial (tags: programming) [...]

  6. Create a flash draw game like Line Rider or others - part 2 at Emanuele Feronato on February 6th, 2007 2:03 am

    [...] Lines 1-5: These instructions are execute only once, when the ball firstly appears on the stage. If you followed my flash game creation tutorial you are familiar with those instructions. I am defining ball x and y speed (set to 0, the ball does not move) and the gravity. [...]

  7. Flash game creation tutorial - part 5.2 at Emanuele Feronato on March 3rd, 2007 3:24 pm

    [...] Code optimization In tutorials 1 to 5.1, I always include the ball actionscript in the ball object. This is correct, but it might create confusion when you have to deal with a lot of objects. [...]

  8. Create a flash draw game like Line Rider or others - part 3 at Emanuele Feronato on March 4th, 2007 7:35 pm

    [...] Line 6: introducing the friction… to know how to apply friction to a ball, refer to flash game creation tutorial part 1 [...]

  9. Flash game creation tutorial - part 5.3 at Emanuele Feronato on March 14th, 2007 12:50 pm

    [...] Read tutorials from 1 to 5.2 if you haven’t done it already and follow me in the game creation. [...]

  10. Flash game creation tutorial - part 3 at Emanuele Feronato on March 14th, 2007 12:58 pm

    [...] Remember to read 1st and 2nd part if you are new to this tutorial, and let’s go. [...]

  11. Tunnelball: design a level for this flash game at Emanuele Feronato on March 24th, 2007 12:43 am

    [...] I want you all to play TUNNELBALL, a complete flash game I developed using most of the topics covered in tutorials 1 to 5.3 [...]

  12. Create a flash game like Security - part 1 at Emanuele Feronato on April 20th, 2007 11:41 am

    [...] Creating the player is very easy, especially if you read the first part of Flash game creation tutorial – part 1. [...]

  13. A strange way to move the player with Flash at Emanuele Feronato on May 30th, 2007 8:15 pm

    [...] Line 6: Defining the friction as we do not want the player to move forever. You can find a tutorial about friction here [...]

  14. Creation of realistic spheres in Flash with textures and masking at Emanuele Feronato on June 10th, 2007 12:51 am

    [...] This code is already explained in this tutorial, and it’s almost the same except it has no gravity since the “camera” is above the objects. [...]

  15. Create a Flash ball game with visual from above tutorial at Emanuele Feronato on June 14th, 2007 12:48 pm

    [...] Being a ball game, I suggest you all to read the basics for a ball game movement in this tutorial. [...]

  16. On the horizon #1 at Emanuele Feronato on June 24th, 2007 2:04 am

    [...] Next part of the ball game creation tutorial [...]

  17. Creation of a Ragdoll with Flash part 1: Verlet integration at Emanuele Feronato on July 21st, 2007 2:58 pm

    [...] Line 7: Updating euler _y position according to its yspeed. Notice that this method is the same as seen in this tutorial. Anyway, people still call it Euler method instead of Feronato method. [...]

  18. Create a Flash ball game with visual from above tutorial part 2 at Emanuele Feronato on August 3rd, 2007 6:35 pm

    [...] Lines 9-10: Defining friction and power as explained in Flash game creation tutorial – part 1 [...]

  19. Flash: Game Tutorials « Rogério Lino on August 23rd, 2007 11:04 pm
  20. Controlling a ball like in Flash Elasticity game tutorial at Emanuele Feronato on September 1st, 2007 9:10 pm

    [...] Lines 5: Hiding the mouse pointer Line 6: Defining the friction. I discussed about friction in this tutorial [...]

  21. Landslide Games Blog » Creating our First Game: Part 1 on September 7th, 2007 7:12 am

    [...] After reading through Emanuele Feronato’s site on basic game creation I started to follow his tutorials on making a simple ball game. Intrigued by the simplicity of this idea presented, I started tweaking variables as I continued to read through, adbsorbing new ideas and methods to add complexity to the new prototype I was developing. At the end of a weekend I had finished Coin Chaser, our current first game Proto-type, which is built closely from the simple ideas presented in that tutorial. I added to it some increasing challenges, like patrolling blocks, and a change in game speed at certain marks, but the game felt like a lot was missing. [...]

  22. | flashgame.gamesforplayers.com on October 2nd, 2007 1:00 pm

    [...] Flash game creation tutorial – part 1 : Emanuele Feronato – blog of March 14th update: part 5.3 released. March 3rd update: part 5.2 released. February 9th update: part 5.1 released. December 31st update: 5th part released. [...]

  23. flashgame.gamesforplayers.com » Blog Archive on October 5th, 2007 8:47 pm

    [...] Flash game creation tutorial – part 1 : Emanuele Feronato – blog of March 14th update: part 5.3 released. March 3rd update: part 5.2 released. February 9th update: part 5.1 released. December 31st update: 5th part released. [...]

  24. Create a Flash game like Metro Siberia Underground : Emanuele Feronato - italian geek and PROgrammer on January 18th, 2008 3:55 pm

    [...] Lines 6-7: Defining ship x and y speeds. x speed never changes. Play with the variables just explained to see how they will affect gameplay. You can find more information about gravity and thrust at Flash game creation tutorial – part 1 [...]

  25. Create a Flash ball game using AS3 : Emanuele Feronato - italian geek and PROgrammer on March 25th, 2008 9:40 am

    [...] am going to create the same prototype explained at Flash game creation tutorial – part 1, just using AS3 The first thing you have to do, is creating the ball itself as a new object, and [...]

  26. How The Game “Hungry Plushies” Was Made « on March 25th, 2008 6:42 pm

    [...] was probobly taken from this tutorial, by Emanuele Feronato. This game just took that tutorial, and made it so that when the right key is [...]

  27. Prototype of a Flash game like Floaty Light : Emanuele Feronato - italian geek and PROgrammer on May 7th, 2008 7:45 pm

    [...] kidding, of course. I made this prototype using the gravity and speed as described in the Flash game creation tutorial – part 1 post, the collision detection as shown in the Create a flash draw game like Line Rider or others – [...]

  28. Brettcr » Blog Archive » Programming Tutorials / Game Making Check Video Description download videos off you tube on May 12th, 2008 11:43 pm

    [...] Flash Actionscript Game Making Tutorialshttp://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/… [...]

  29. Elise » Programming Tutorials / Game Making Check Video Description convert youtube video to dvd on May 19th, 2008 4:26 am

    [...] Flash Actionscript Game Making Tutorialshttp://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/… [...]

  30. Step by step AS3 translation of Flash game creation tutorial - part 1 : Emanuele Feronato - italian geek and PROgrammer on June 11th, 2008 8:38 pm

    [...] Today I am glad to publish the work of Tim Edelaar that translated all AS2 files of the most successful post of this blog, Flash game creation tutorial – part 1. [...]

  31. Tutoriais « Gameslmjb’s Weblog on August 31st, 2008 10:33 pm
  32. Adobe Flash Tutorial Part 2 on September 8th, 2008 10:55 am

    [...] Flash Game Creation 5 series of tutorial to make a simple game. [...]

  33. reducedoverlarge » Trailer for the upcoming Echo Wall climbing film on October 8th, 2008 7:32 am

    [...] Flash Actionscript Game Making Tutorialshttp://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/… [...]

  34. forfreebigger » Diving with Sharks at the Chumphon Pinnacles, Koh Tao Thailand on October 9th, 2008 2:18 pm

    [...] Flash Actionscript Game Making Tutorialshttp://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/… [...]

  35. Presentation: Flash Games « Dart 381 on October 21st, 2008 4:16 pm
  36. Programming Tutorials / Game Making Check Video Description convert files from youtube : nocostlargish on November 9th, 2008 4:49 pm

    [...] Flash Actionscript Game Making Tutorialshttp://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/… [...]

  37. couponlargish » Vegas-Promotions.com on November 10th, 2008 1:32 pm

    [...] Flash Actionscript Game Making Tutorialshttp://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/… [...]

  38. discountsize » 7 Tips for a Fun Filled Family Holiday Posted By : Johnn on November 12th, 2008 11:32 am

    [...] Flash Actionscript Game Making Tutorialshttp://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/…http://www.emanueleferonato.com/2006/… [...]

  39. Actionscript Basics - Keyboard Input on March 12th, 2009 6:46 am

    [...] a more sophisticated keyboard control, check out Emanuele Feronato’s tutorial. This entry was posted in Actionscript, Tutorials and tagged Actionscript, [...]

  40. pligg.com on April 30th, 2009 8:28 am

    Flash game creation tutorial – part 1 : Emanuele Feronato…

    Flash game creation tutorial – part 1 : Emanuele Feronato…

  41. Create a game like ball revamped | Tutorial Collection on June 27th, 2009 5:06 am

    [...] View Tutorial No Comment var addthis_pub="izwan00"; BOOKMARK This entry was posted on Saturday, June 27th, 2009 at 8:36 am and is filed under Adobe Flash Tutorials. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site. [...]

  42. Flash Tutorial on July 18th, 2009 2:42 pm

    [...] Flash game creation tutorial – part 1 : Emanuele Feronato [...]

  43. [Flash CS4] - x y-Bewegung in Vektoren? - Flashforum on October 13th, 2009 1:43 pm

    [...] [...]

  44. Triqui’s Picks #1 : Emanuele Feronato on October 18th, 2009 2:24 pm

    [...] difficulty: the concept has been discussed in my first Flash game tutorial… [...]

  45. Making a basic flash game! HELP! - Overclock.net - Overclocking.net on January 6th, 2010 1:19 am

    [...] found this quite helpful when I was looking into that sort of thing http://www.emanueleferonato.com/2006…torial-part-1/ __________________ My case mod project: Millennium Falcon NZXT Rogue Black/Blue LED For [...]

  46. Flash Game Development for Beginners — FlashRealtime.com on January 22nd, 2010 12:11 pm

    [...] Check it out here [...]

  47. Mal kurz rundgeschaut… #9 – Braekling.de on January 23rd, 2010 10:44 am

    [...] Flash Game Creation Tutorial – Eine mehrteilige Anleitung von Emanuele Feronato. [...]

  48. Great tutorial for Game developer beginners « rksaran on January 25th, 2010 12:22 pm

    [...] tutorial for Game developer beginners http://www.emanueleferonato.com/2006/10/29/flash-game-creation-tutorial-part-1/ [...]

flash games company