Balloon movement in actionscript 3
My bio... hmmm... what to say... I arrived on this crazy world clearly by mistake on March 81, in a far, far forgotten small town with more problems than a whole nation, close to the pacific ocean in the Colombian territory, it is called Cali. Early I began playing with some gadgets like "telebolito", "intellivision", "Atari", and it was here when I started feeling interested in games and how they are being done but before start programming I've learned to play piano a guitar (I love music, can't live without it). Then I learned some programming languages such pascal with Borland Delphi, and C++ but I have to confess that it was Macromedia Flash who changed my life once we met each other in 98. I'm working with it since it didn't have support of mp3 audio format files, yes the version 3. And then together (Flash and I) started travelling around south america looking for a better job opportunity and professional development than my hometown could offer us at that moment. Special thanks to: Brazil, Costa Rica and Colombia for being a great school. At this moment I'm happily living and paying taxes in London, UK but like a salmon fish one day I will be back to procreate :)
This Balloon was an experiment I did playing a bit with Verlet physics (if I can catalogue the Verlet concept as part of physics). Using Verlet can be quite powerful but at the same time is a bit limited due to the simplicity of how physics are applied, we don't have much control of it and for adjusting stiffness between dots we need to do quite much, there are some people out there working a lot with it and making amazing things like this physics engine for action script 3.
In this experiment I made a rope (string) based on 30 dots linking them each other by using Splines curves. There is not mystery on this project, it can look complicated but it is not, it is based on the normal behaviour of Verlet particles. Verlet concept is very simple but looks like a huge monster engine running behind when what it does is basically moving dots on the screen based always on their previous positions, so the speed and direction of each dot is defined just by using the difference between its current position and the previous one and at the end all we need to do is just stick all dots together again trying to maintain same distance they got from the beginning to maintain its shape (polygon made of these dots).
At this moment I got a really basic system for animating this balloon, it is still a beta version but what I got so far can be downloaded here; I hope it could be usefull to someone, I have to finish it as soon as I have some spare time. Also I'm planning to break the whole source code in order to explain well detailed each part of it. I think it is really important understand how it works, you could apply these concepts almost in any kind of project (interactive game) you do if you want to have a beauty UI and offer a cool user experience.
With the source code I just added a tiny SWC called BalloonSkin.swc, it contents the balloon MovieClip (Sprite, it is not animated) that is being used in the program but the rest is being drawn on the fly. All you need is the Open Source Flex SDK, this source code is compatible with flash player 9, and don't forget to add the SWC when you compile it by using the parameters –library-path+=BalloonSkin.swc
Pull the balloon by the string with your mouse, but be careful I'm not validating screen dimensions, so if you lost it you may refresh your browser to see it again, lol!