Posts Tagged ‘3.0’

Changes to Box2DFlash “Hello World” example.

Tuesday, April 29th, 2008

I’ve talked about the basics of Box2DFlash v1.4.3 in my Introductory tutorial. I showed how to create your world and how to introduce simple bodies into that world. With the release of Box2DFlash v2.0.0 the basics remain mostly the same, there are a few details changed. I need to go over these small changes before I move on to the next step of adding joints and forces to the bodies.

The first and biggest change (although really a small thing) is that we no longer work in pixels! We now work in units that by default equal 30 pixels to 1 unit (think of it as meters; 30px : 1m). With this change our normal gravity is no longer (0, 300) but instead (1, 10). This makes more sense to me at least because gravity in reality is 9.81 m/s/s. This is going to effect almost everything you do, from applying forces to setting the width and height of a box.

(more…)

Physics in ActionScript 3: Box2DFlashAS3

Monday, March 17th, 2008

I wanted to try something fun with Flash this week, so I did a quick search for “Flash Physics Engine.” Lo and behold, I struck gold. Box2DFlashAS3 is an open source ActionScript 3.0 conversion of the C++ Physics Engine Box2D. I’m very impressed with its well coded structure and easily implemented nature. I learned a few new things that will change how I code forever just by reading through their example files.


Still, they have limited resources right now as far as help documentation goes (”Please refer to the source code from the examples provided to get an idea of how to use Box2DFlash in your projects.” — that’s the ReadMe.txt that comes with it… not very helpful,huh). I thought I might give you an example of my own and walk through it step by step.
(more…)

Intro to ActionScript 3.0 Tweening

Monday, March 10th, 2008

I am going to talk about how to animate using Tween objects in ActionScript. Tween objects are enormously useful. They can change any numeric property of any object over time.

For example one of the most common uses of Tween objects in ActionScript is to fade an image out as another fades in. The advantage of using a Tween object to do this instead of any of your other options is

  • 1.) it is easy to understand
  • 2.) it is the easiest to code
  • 3.) it generally looks the best.

It’s fairly easy to write a bit of code that will change the X position of a movieClip by 2 every frame, but that will be very linear and boring. Also when does it stop? and how? You would have to create a lot of if() statements that just take forever to think through and would make your code harder to read. (VQ: lots of nested if statements are usually a thing to avoid)

With a Tween object you can use Easing methods. In the example that follows I used the Easing method Regular.easeInOut to start the motion with a little acceleration and then bring it to a stop in the same way.

If the motion of the dot gets annoying you can stop or start it again at any time by clicking on the Flash movie. (more…)

Putting ’static’ to good use.

Monday, March 3rd, 2008

 

I’m going to talk about how to build a simple 4 function calculator using static variables and meathods in Flash ActionScript 3.0. This is my first tutorial, so if you have questions or comments, I would appreciate them and will do what I can.


(more…)


Warning: stristr() [function.stristr]: Empty delimiter in /home/vmnstudi/public_html/wp-content/plugins/wassup/wassup.php on line 2093