Welcome guest, here you can read the whole selected article.

The website with source code tutorials for programming flash games.
If you are looking for a fun, you can also play my online games.

Home | Tutorials | Games | Others | About »  Sign Up | Log In  « 



Creating a ball trajectory to look like a moving ball in 3D perspective - Part 4

Posted on 28-Apr-2008, 13:31:51
All parts of this tutorial series: 1 2 3 4

Theme: Implementation of ball moving using Bezier curve

I think it’s time to finally implement a ball moving by previously constructed Bezier curve.






As usual, we are starting with definitions for global variables. Fortunately, we have only one new variable in this part of the tutorial – currBezierPoint. It is used as a pointer to the current Bezier point so we can cycle from the first to the last Bezier point and change current position of the ball.

Here is the code for cycling through the Bezier points and drawing ball movement (by the way, this code is placed in the main loop of the program):



Of course, don’t forget to draw a simple ball movie clip called ball_mc!

It remains to mention still one thing. Every time when we call the function that computes a new Bezier curve, we must reset currBezierPoint to point to the first Bezier point! It’s done in the next function:



Well, it seems that’s all. Simple, don’t you think so? Here you can test the program:





Complete source code you can download here!

In the next final part of this tutorial series we will add a shadow below the ball to make a full feelling of the ball moving in 3D perspective.







Comment(s):



Karank said on 27-Sep-2008, 15:17:53:

hi



Please login if you wish to post your comments!

Games





Recent articles





Copyright 2009 © Ask For Game Task. All rights reserved.