Computer Science Canada

How to Shoot...

Author:  DonQuixote [ Wed Jun 16, 2004 7:14 am ]
Post subject:  How to Shoot...

I am trying to make a (semi-) Starcraft game that works perfectly so far. But there's only one problem ... How do I make the spacecrafts shoot in the direction that they are facing??? This plagues up the entire game... when i tried myriad ways, all failed... Plz Help!
THANX A LOT!!!

Author:  SuperGenius [ Wed Jun 16, 2004 9:50 am ]
Post subject: 

It depends on the viewpoint. I assuume you used an isomatric setup like in starcraft?

Author:  AsianSensation [ Wed Jun 16, 2004 11:06 am ]
Post subject: 

well, if you know what angle they are facing, then shooting is easy.

instead of normal bullets that goes straight up like this:

code:
loop
    y += 5
    drawfilloval (x, y, 5, 5, red)
    cls
end loop


do something like this:

code:
loop
    y += sind (angle)
    x += cosd (angle)
    drawfilloval (x, y, 5, 5, red)
    cls
end loop


where the variable angle is the angle they are facing.


: