Math for 'Curtain Shooter' Games

  • Thread starter Thread starter Bucky
  • Start date Start date
AI Thread Summary
The discussion centers on creating a 'curtain shooter' game, focusing on the mathematical aspects of plotting bullet trajectories in a side-scrolling shooter. The main challenge involves calculating the positions of bullets around a growing circle, which requires understanding 2D geometry and trigonometric functions. Key steps include determining the angle between bullets based on the total number of bullets and using sine and cosine functions to calculate their (x, y) coordinates. The circle's radius must increase each frame to simulate growth, and it's important to convert angles to radians for accurate calculations. The conversation concludes with a successful resolution of the mathematical problem, emphasizing the simplicity of the solution.
Bucky
Messages
79
Reaction score
0
Hi, I'm trying to create a 'curtain shooter' game. Essentially this is a side scrolling shooter (think Gradius, R-Type etc) but the enemies throw out a rediculous number of bullets. Here is an example:

http://www.sss-mag.com/images/strayfire2.jpg

could anyone advise me as to how I could do the mathmatical side of this? I've looked at what I am trying to do and have summarised that I need to:

i) Create a circle (n.b - this isn't a problem)
ii) Plot points at regular points around the circle (this is where the problem lies)
iii) The circle will also have to grow by a set amount each frame, and the space between the intervals will have to grow also.

I was also hoping to do something with sine and cosine waves.

However I am not sure how to approach this (I get the feeling its a lot easier than I think it is...its 2d geometary). Is there a specific topic i should look up? Can anyone recommend specific reading?
 
Last edited:
Physics news on Phys.org
Give each bullet a certain angle if there are n bullets then the angle between each one startion from 0 would be 360/0. To get the bullets (x,y) position were the distance of each bullet from the center is r,
x = rcos(angle), y = rsin(angle) - (don't forget to change to radians first. I'm not sure about other languages but in C/C++ the sin and cos functions take radians as input)
Now you simply have to increase the r every frame.
 
Thats exactly what i needed. Thanks a lot for your help! :)
 
So I know that electrons are fundamental, there's no 'material' that makes them up, it's like talking about a colour itself rather than a car or a flower. Now protons and neutrons and quarks and whatever other stuff is there fundamentally, I want someone to kind of teach me these, I have a lot of questions that books might not give the answer in the way I understand. Thanks

Similar threads

Replies
25
Views
4K
Replies
4
Views
1K
Replies
2
Views
3K
Replies
48
Views
66K
Replies
4
Views
4K
Replies
4
Views
3K
Back
Top