Flash Elasticity prototype – AS3 version

Today I am porting an old tutorial, Controlling a ball like in Flash Elasticity game tutorial, into AS3.

I am doing this because it was a great game in my opinion, and one of the “non Box2D powered” games that can live a second life now that Box2D has been released.

About all the theory and the objects used, refer to the original post, this is just a starting point.

Anyway, let’s see the code… there are five classes in this prototype:

main class

This is the main class, the one calling all subclasses

circle_mc class

This is the class relative to the big circle you can move the crosshair in:

I just place it in the middle of the stage.

newmouse_mc class

This is my mouse replacement

And I just follow the mouse…

crosshair_mc class

The crosshair follows the mouse but can’t go outside the big circle

ball_mc class

Finally, the ball follows the crosshair with an elastic effect

And this is the result:

There are several ways to use this prototype… I’ll show you how to integrate it into a Box2D world during next days.

Download the source code.

  • abhilash

    nice to see that you are again making some beginner tutorials didn’t really like the box2d tutorials hope you keep on makng such tutorials

  • vitaLee

    ohh myy.
    the source looks UGLY. :(
    i wouldn’t reckomend any novice taking ideas for their code structure from the source files.
    the whole prototype scattered around 5 classes just makes it so hard for newbies to grasp the whole idea.
    i don’t actually know what you were trying to achieve with this tutorial.
    if it’s idea was to present the prototype itself – it’s fail.
    if you were trying to presenta the prototye in AS3 , following some of the best practices then it’s a fail again.
    sorry to say that

  • Guillermo Roman

    vitaLee, any validity of your critical remarks are no where near as important as Sr. Feronato’s prolific, selfless contribucions to the Flash gaming community. Really, your take is more harsh than it needs to be. Shush and enjoy this treasure trove of a site and have no doubt, as busy as Emanuele must be daily, he could code his projects to the utmost of professional “best practices”.

  • vitaLee

    Guillermo i have to apologise that my words seemed a little bit harsh, but they reflect my point of view.
    I’m more than sure Emanuele’s got lots of skills and is quite proficient in what he’s doing, and that’s exactly why i expressed myself that way.
    Of course you can tell me to stay “low and quite” but certanliy won’t enjoy this post.
    i’m sorry Emanuele if i hurt your feelings

  • Emanuele Feronato

    @vitaLee: don’t worry, I accept every kind of critics.

    Every programmer has his own principles, I don’t use uppercase in variable names but I use a lot of underscores… and try to split the code as much as I can.

    I agree with you this time I did it too much.

    What about sending me your version? I will be happy to publish it and glad to follow your guidelines if this can help readers.

  • vitaLee

    i’m ok with different code formatting styles, that’s not what i had in mind.
    why is it so hard to find your email on your personal blog? is it because of the spammers? :)

  • Pingback: At what age should women start using anti-aging cream?()

  • Thanks a lot for this trick !

    I’m a newbie in AS3 and I just began to wrote some stuff a few weeks ago, but I think I’m good enought to say your code is pretty good !

    Many Class, ok, but it still really clean and usefull. That’s the most important I guess.

    @vitaLee : Where is your blog and your last post ?! I wanna see your code ;-) ah ah


  • Pingback: ?Stencyl??Flash??Slingy???????? | Flash?????()