Adobe flash cs4 Game tutorial : Velocity

Adobe flash cs4 Game tutorial : Velocity


Get Fla
learn to create Velocity in this Adobe flash cs4 Game tutorial. using as3 and the key class code. goto http://www.youtube.com/watch?v=lMQrshyK8_c to learn about key object.

4 comments:

Brennon said...
This comment has been removed by the author.
filic.brgkepler said...

Hi. First I want to thank you for uploading all this fency things. I'm pretty new to flash but you lernt already thaught me a lot of things.

But i really have a problem figuring these 2/3 lines out:
"var angle:Number = ship.rotation*Math.PI/180;
var vx:Number=Math.cos(angle)*speed;
var vy:Number=Math.sin(angle)*speed;"

the first one is obvious. you are converting DEGs into Radiants.
the next 2 lines confuse me. the problem for me is to understand why you need the cosinus/sinus function. is it maby possible for you to draw it so i can visualize what is happening?

I'm sure there are some other people too who dont understand it.

i#d be very happy if you could help me on that topic.

cheers.

Waarith Abdul-Majeed said...

Math.cos(angle)*speed and Math.sin(angle)*speed are ratios. cos and sin take the angle in radians. They return a number between 0 and 1 depending on the angle given. Getting a value from 0 to 1 is exactly like getting a percent. sin and cos determine what percent of speed to add to the x and y of the object according to the angle.

Anonymous said...

Love the tutorials! very helpful... could you do something with Lives and Scoring? thanks a lot!