Original Post
🔒 Locked
2d game
Advertisement
well, given an angular velocity (how fast they follow the circle)...
angle += angular_velocity * dt;
x = circle_centre_x + circle_radius_x * cos(angle);
y = circle_centre_y + circle_radius_y * sin(angle);
dt being the time elapsed since last position update, or a fixed time, like (1.0f / 60.0f), 60 being equivalent to 60 fps.
you can move the circle_centre, and change the circle_radius, to make the enemy ships circle move and change shape. having a different radius along x and y will make them follow an ellipsoid. You can make the circle pulse that way, and make the circle bounce or follow an ellipsoid.
angle will also be a parameter for every ship, like x and y.
[edited by - oliii on January 4, 2004 9:03:47 AM]
angle += angular_velocity * dt;
x = circle_centre_x + circle_radius_x * cos(angle);
y = circle_centre_y + circle_radius_y * sin(angle);
dt being the time elapsed since last position update, or a fixed time, like (1.0f / 60.0f), 60 being equivalent to 60 fps.
you can move the circle_centre, and change the circle_radius, to make the enemy ships circle move and change shape. having a different radius along x and y will make them follow an ellipsoid. You can make the circle pulse that way, and make the circle bounce or follow an ellipsoid.
angle will also be a parameter for every ship, like x and y.
[edited by - oliii on January 4, 2004 9:03:47 AM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement