This tutorial will teach how to Create a Pong Game in Flash using ActionScript 2.0. It will be separated in different parts. In this part of the tutorial, we’ll configure the file, plan our work and create the menu.

First of all, let’s configure the file. Create an ActionScript 2.0 File. In the Properties tab, size your document 550×400 (Flash default) and change Frame Rate to 30. It’s everything.

Now, create 7 Keyframes. Name their labels like this:

  • 1st Frame - first
  • 2nd Frame - menu
  • 3rd Frame - mode
  • 4th Frame - p1
  • 5th Frame- p2
  • 6th Frame- final
  • 7th Frame- ins

We won’t do anything with the first frame for now. In the second frame we’re going to do the menu. So, write the game title and create a button for 1 player, a button for 2 players, and a button for instructions. Then, instance the buttons like ‘button1′ for the 1 Player button, ‘button2′ for the 2 Players Button and ‘button3′ for the Instructions button. Now it should be looking like this:

Game Menu

Game Menu

It should look like this… Not the same, of couse… Now, it’s time for some ActionScript. In the 2nd frame ActionScript, write:

stop();

_root.button1.onRelease = function(){
_root.gotoAndStop('mode');
}

_root.button2.onRelease = function(){
_root.gotoAndStop('p2');
}

_root.button3.onRelease = function(){
_root.gotoAndStop('ins');
}

Now, if the ‘button1′ is pressed, it will go to frame ‘mode’. If the ‘button2′ is pressed, it will go to frame ‘p2′. And finally, if the ‘button3′ is pressed, it will go to frame ‘ins’.

Now, your menu is finished! If you click one button, you’ll go to a blank page (because we didn’t anything with the other pages).



If you had any problems, download my file here . Continue in the Creating a Pong Game main page.

Share this post:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Live
  • E-mail this story to a friend!
  • Print this article!

Related Posts:

This entry was posted on Sunday, June 22nd, 2008 at 4:44 pm.
Categories: Flash Games.

17 Comments, Comment or Ping

  1. Your blog is interesting!

    Keep up the good work!

  2. Dillon

    Why do you assume we know exactly how to do these things? Can you please go into a little more detail in how to do these action script things and how to assign them to only one keyframe?

  3. Dillon

    after much fiddling, I figured it all out, but I still think that it would be a good idea for those of us who are quite “noobish” to this stuff.

  4. cereal killer

    hey cool tut thx but i got the idea its not working i learnd on school with flahs if it acts like its acting now it misses a stop and i also get some errors erhm help!? o.o
    i get 7 errors when i try to start it and when i open it it trips on the screan

  5. Kyle

    I thank u for the tutorial, but i couldnt figure out how to make and place a button. Maybe its cuz im on a mac, but I cant figure it out. MX Pro 04, right?

  6. Dillon: Can you say what I should add? Thanks…

    Cereal: Can you say which errors you got? I can’t help you without knowing.

    Kyle: I use Adobe Flash CS3 Professional. But I think it’s almost the same… Maybe it’s bacause you’re on Mac… I’m not familiar with Mac… Is there F1, F2, F3, [...] buttons in Mac’s Keyboard? Or try finding the ‘Add Symbol’ button in the menu. F8 is the shortcut to it.

  7. Kenneth

    Hey i really think its nice that you have made this guide but i have some questions

    i made it like you said i should but when i test the menu cant i push the buttons… why??? … i made the text-box with “dynamic text” then made it a button… just a button with the name “symbol 1″ and then i pressed “OK” … did i miss something? i did make the instance name “button1″ and the second button “button2″ and so on…..

    could it be the code?? i copy/paste from here on the site… i just dont get it … when i test the menu cant i push the button.. my arrow just become a line like when u wanna edit the text… please help

  8. kenneth

    hey dude… i could not get the buttons to work… then i tryed to download your menu… it seems that you have done something other than just maked your buttons with a textbox you converted to a symbol and gave the instance names….. what is the gray colour behind the text??? cant see it… when i click on your button in flash it says its mixed

  9. Kenneth: E-mail me your file. Maybe I can help. bianconi.gabriel@gmail.com

  10. Steve

    Yea i’m having the same problem, when i click on the buttons, nothing happens. i’m using Macromedia Flash Professional 8, could that be the problem? what program do i use?

  11. Steve: The problem shouldn’t be the software… Can you e-mail me the file? bianconi.gabriel@gmail.com

  12. wout

    Hey what program should i use?

  13. Wout: Adobe Flash CS3/CS4…

  14. seth

    hey, all the codes given contained Syntax errors.. when i tested the movie, it doesnt stop at the menu page.. but instead, it played continuously over and over again..

  15. Seth: You wrote something wrong. E-mail me your file. bianconi.gabriel@gmail.com

  1. Creating a Pong Game - Aug 13th, 2008

Reply to “Creating a Pong Game - Part 1”