1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

'Curtain Shooter' Math

  1. Dec 3, 2005 #1
    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:


    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 isnt 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 im 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: Dec 3, 2005
  2. jcsd
  3. Dec 3, 2005 #2


    User Avatar
    Gold Member

    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.
  4. Dec 3, 2005 #3
    Thats exactly what i needed. Thanks a lot for your help! :)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook