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!

  • krabex

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

  • Seth

    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

  • Massimo M.

    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 :)

  • Pingback: Porting a game in ActionScript 2 to ActionScript 3 | zedia flash blog()

  • 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

  • Pretty nice improvment.

    I guess the bounce factor should be customable.

  • Frederik J

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

  • Massimo M.

    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!

  • Pingback: A Gem of Flash Game Tutorials | Newbie Game Programmers()

  • Marre2795

    its a good tutorial but how can we add wind

  • Pingback: Create a flash artillery game – step 1 : Emanuele Feronato()

  • Gunny

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