View Full Version : help with asteroids type game?
10-07-2008, 12:24 AM
I am still kind of new to flash. I've used it for a year but in high school. I am trying to figure out script, go the direction the space ship if going. I have the keys working and the ship rotating but I have no idea how I would make it just go forward at any direction. I would be very gracious of any help. thanks
10-07-2008, 12:59 AM
Hi, this is for static movement speed, obviously you can make some changes so he speeds up and stuff but this should allow you to get an idea of the maths behind simple angular based movement.
var cons:Number = 2 //Constant speed variable
onEnterFrame = function()
if (condition) //Your condition to let the mc move
my_mc._x += Math.sin(my_mc._rotation * (Math.PI / 180)) * cons;
my_mc._y += Math.cos(my_mc._rotation * (Math.PI / 180)) * cons * -1;
10-07-2008, 01:00 AM
After reading that page go to contents and download the source file. Its lesson 4 for movement. It wouldn't hurt if you went through the whole tutorial, some good stuff there.
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.