Build 10 classic Flash games and learn game development along the way with this ultra-fast paced game development course.

If you love this blog, this is the book for you.

Buy the book

Get the source code of 12 commercial Flash games, which have been loaded more than 50 million times!

Learn from real world successful examples.

Get it now

Box2D for Flash Games teaches you how to make Flash physics games from scratch with the most advanced features.

Create the new Flash game smashing hit.

Buy the book

Artillery with bounce: a modification of Artillery tutorial

I received an email from Massimo M. – an italian reader – that modified the code explained in Create a flash artillery game – step 1 tutorial.

Massimo wrote:

“Hi, my name is Massy and I browsed your tutorials about Flash games. I think they are very good.

I modified a bit your artillery 8 file adding two rows to the code and obtaining some kind of artillery 9. I am attaching it in case you are interested in publishing it.

I’ve just added elastic bounces to cannon balls when they hit the ground, using a low bounce factor to make it “realistic”.

This is the code to replace in the first frame:

and this is what you’ll get:

As you can see, now cannon balls bounce when they hit the ground.

Here it is the zip file with the source code.

Thank you Massimo!

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (6 votes, average: 4.83 out of 5)
Loading ... Loading ...
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.
Be my fan on Facebook and follow me on Twitter! Exclusive content for my Facebook fans and Twitter followers

This post has 12 comments

  1. krabex

    on October 29, 2007 at 6:33 pm

    You can add some friction too that also to give some more realism. Velocity *= Friction (0.95 is pretty good)

  2. Seth

    on October 29, 2007 at 9:24 pm

    Looks very cool, it add a nice look to the game.
    But, some balls stay too much time in stage, you may want to slowly fade them out :)
    Sorry for my bad english :s

  3. Massimo M.

    on October 29, 2007 at 11:35 pm

    Good idea for the next time ;)

    it can be a good idea to fade out the ball after 2 or 3 bounces or at least after X seconds

    Massimo :)

  4. Porting a game in ActionScript 2 to ActionScript 3 | zedia flash blog

    on October 30, 2007 at 5:14 am

    [...] I blogged about a post on Emanuele Feronato’s blog. Today he put on is blog some code on an artillery game. It is nice code, but it is in ActionScript 2. I thought it would be fun to try to make the same [...]

  5. zedia.net

    on October 30, 2007 at 6:15 am

    I you want to continue upgrading this game, you should consider ActionScript 3. I already converted it, you could go on from there.

    Here is the source
    http://www.zedia.net/2007/porting-a-game-in-actionscript-2-to-actionscript-3/

  6. Monkios

    on October 30, 2007 at 2:52 pm

    Pretty nice improvment.

    I guess the bounce factor should be customable.

  7. Frederik J

    on October 30, 2007 at 2:58 pm

    Nice. How i just love contributions. I’m on my way, to make another game, with help from this site. Good, Massimo!
    /Frederik

  8. Massimo M.

    on October 30, 2007 at 5:32 pm

    tnx you Fred! ;)

    (for monkios) to change the bounce factor simply change the “0.3″ value in line 44.

    (for Zedia) tnx but for now i prefer to concentrate on version 2 cause i prefer better support for all to see my works ;) i will pass on flash 9 or more later!

  9. A Gem of Flash Game Tutorials | Newbie Game Programmers

    on December 17, 2007 at 4:23 pm

    [...] Create a flash artillery game – Part 1 :: Part 2 :: Modification [...]

  10. Marre2795

    on September 21, 2008 at 4:19 pm

    its a good tutorial but how can we add wind

  11. Create a flash artillery game – step 1 : Emanuele Feronato

    on September 4, 2009 at 4:01 pm

    [...] 25th update: 2nd part released October 29th update: modification with a bounce effect developed by Massimo [...]

  12. Gunny

    on August 6, 2011 at 3:51 am

    Simple and easy. A breeze to convert to AS3. I searched high and low for an easy tutorial. A+