Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Necrum
21
Years of Service
User Offline
Joined: 31st Dec 2002
Location:
Posted: 27th Jan 2003 03:01
Im trying to make asteroids and I coded the controls for the ship.....(circle).... I coded the screen so when the circle goes off the screen it returns to the other side.

I'm trying to figure out how to make the circle shoot. Any help would be appreciated.
This signature was bought by Bill Gates
The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 28th Jan 2003 01:00
The ship should have an angle at which it is travelling. By using this you can fire missiles in the direction the ship is turned. Make an array which holds the shot data, then when you fire, put the current coordinates of the shot and the angle into the array. Then you can increment the coordinates using sin and cos if you know how, or newxvalue if you don't. Simply draw the missile at the coordinates and update them every cycle. When the shot runs out of life, position the shot off the screen somewhere and either make it have no velocity or a flag that tells the program whether it has been fired or not.

Login to post a reply

Server time is: 2024-05-17 14:40:47
Your offset time is: 2024-05-17 14:40:47