Monday, April 2, 2007

Gravity Study using Macromedia Flash Professional 8


Before Gravity





After Gravity













Printscreen of Macromedia Flash

I decided to give programming another try since my freshman high school days when I first learned Java and was it an eye opener trying to remember what I had learned. I did remember how fustrating it can be to program because honestly unless you can think like a programmer step-by-step multi-tasking several thoughts to stream it into simple commands, you may not like it.

I first started to download the Processing Beta program but for those of you that want to, don't because it is a corrupt file and will freeze your computer for several minutes and still will not load correctly.


I then researched the programming behing Google Sketchup who's programming console is called Ruby. Ruby is located under the tab window as the last button. I searched for tutorials but as many as you would think would show up not as many were because most people didn't know there was programming even available to use and bundled up in the program. Inclusive of the program are plug-ins and different coding for different functions. I tried programming it a couple of times and I was unsuccessful in many attempts since I wasn't used it and quiet frankly it seemed to be easier to just do it using drawing instead of specifing line by line and so forth.
Sketchup though, is a great program and for someone knowledgeable of how to program it is very simple to use but personally I didn't care much for it. As far as tutorials go, simply click on the Help button and type in your search where you can find basic tutorials on how Ruby works.


Here are a couple of tutorials if you are interested in learning Ruby:
"Programming Ruby" online at http://www.ruby-doc.org/docs/ProgrammingRuby/
The "Ruby user's guide" online at http://www.ruby-doc.org/docs/UsersGuide/rg/
"Introduction to Ruby" online at http://www.ruby-doc.org/docs/Tutorial/
"Learn to Program - A Tutorial for the Future Programmer" on line at http://hellotree.gotdns.com/LearnToProgram/

I then turned my attentention to Macromedia flash and searched for tutorials. The tutorials I found to be most interesting were those of how gravity worked because from understanding the basic concepts behind how the program works it can be translated for use in video games as many tutorials based on that showed up. I started with a circle and drew it in the stage area where I modified it to become a symbol and later an action clip with a designated name. I then added the code under the layer of that circle and changed the components of the gravity and acceleration in order to regulate how fast and slow and how far the circle would fall. The program script had a built in way of controlling the circle by using the arrow keys to make it shift left and right. The reason for experimenting with the code is because really the only way you're going to learn is from trial and error and experience. Honestly, you can read a thousand tutorials but it's not until you start to try and work it out for yourself that you start to get a better understanding of it. You could change the up and down motion based on the principles of math and acceleration in relation to gravity. At the same time the more you changed the variables they were affected to the background coordinates or plane of x and y axis which would cause the ball to speed up or slow down in certain areas as well as speed up to the point of flashing as is shown in the second picture above where the green ball goes missing. In fact it is not missing but is caught in motion flashing. If you didn't put constraints on the balls they would simply run off the page and start over again in a loop. The little creature icon with a smiley faced nicknamed Skeeter was a face that was based directly on the principles of gravity and slid down slowly leaving behind his standing face. Skeeter and each of the balls were on different layers were the code was added. The program when executed showed the balls and skeeter in motion. Using the side left and right toolbars the balls would move accordingly but still up and down.


Using the program, animation could be done but buttons and non-moving objects could be made as well using the basic paint tools. The main thing is designating each object in motion to declare it's name for use in it's program under it's layer.

Tutorials in both programs were helpful as were the help toolbars, but in regards to programming it is not something you can learn overnight or even over a series of years because as you start to grasp the concept another program is created and yours has already become obsolete. The basic ideas are there which can be used later and the mindset discussed earlier is what will make you a programmer. It is based on experience and learning and reading others codes and practicing with much trial and error. Personally, I do not care for programming many the mindset of breaking down things, perhaps I overanalyze and I know for sure I overthink things sometimes to the point of overcomplicating things that are basic, but I do have a great respect for those that do program. Most of the world we function in is based on programs everything from handheld devices such as Gameboys to computers to television channels. It is how the world is organized of one event affecting another to cause an effect.

Here are a couple of websites I used to find tutorials:
http://www.tutorialized.com/tutorials/Flash/Games/1

These are the two tutorials used from the website above to cross refernce the code including the help feature from the Macromedia Flash program.
Gravity in Games http://www.tutorialized.com/tutorial/Create-Gravity-in-Games/22963
Steering a Falling Ball http://www.tutorialized.com/tutorial/Steer-A-Falling-Ball/22810

3 comments:

Unknown said...
This comment has been removed by the author.
Unknown said...

You can check out my Ruby Study Notes, the way I learned Ruby, here -
http://rubylearning.com/

Erica Salinas said...

Thank you Satishtalim for your help. It is greatly appreciated as well as your comment. Have a good day! --Erica Salinas