Monday, February 11, 2008
Exercise 3.2
So for the first of three, I did a simple car moving along the screen. It accelerates, and the car even rotates to show the intensity of its speed. Although when the shadow rotates with it it looks kind of silly. Maybe if all of this wasn't so scripted...
The second one is an extension of the first, but this time the ball moves in two directinos, so both X and Y accelerations are being calculated. The car shoves off with predetermined constants, giving it a still scripted feel...
The final of the three, which was the most difficult and time consuming, is definitely my favorite. Even though some of it is still scripted animation, much of it is not. The robot pulls his arm back through constants, but after that the arm is given initial velocity and the rest is math. Probably not the purest of math or physics, but it still looks pretty good. The most difficulty with the swinging arm was getting it to stop. The most effective solution was to cut the velocity in half whenever it was at neutral (straight down) position. The car, however, is completely code. Through trig, the car is attached to the arm, moving and rotating accordingly. This was exceptinoally hard to do, and probably took the longest amount of time. The problem was in the arm's rotations. I thought it had to do something with Flash's rotation scale, but it ended up being that I was thinking in degrees, not radians. Whoops. Anyways, once the car reaches a certain rotation, it detaches from the robot and then is affected by gravity. The lauch position is completely alterable, so changing the value will change the trajectory. Take a better look at it here:
Dog's Solution
Can you name the game?
The exercise was fun though, and very rewarding. It's a good reminder of how long getting code to work well takes (even for the simpliest of things!)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment