Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Space Shooter
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mynameisbob




PostPosted: Mon Jul 05, 2004 7:38 pm   Post subject: Space Shooter

Here is a space shooting game I've made. You fly from a first person perspective. Right now you can only fly by the earth. Up arrow is to accelerate forwards and left and right is to turn. I havnt added up and down movement yet. Shift is to fire.

I have a few problems, I get an error "Cannot allocate item. Out of id numbers (max 1000)" when I hold the shift key down for about 20 seconds. And also when you want to use the Pic.Draw command how do you set the picture coordinates so that x, and y refer to the middle of the picture instead of the bottom left corner?
And one more problem, how can I make the program so that when you pass the earth on the left side, the earth will fly by on the left side, and when you pass it on the right side it should fly by on the right side. You'll understand what im talking about after you
run the program. Right now the earth only flies by on right side no matter what side you pass it on.



Space.rar
 Description:
Download Here...

Download
 Filename:  Space.rar
 Filesize:  38.07 KB
 Downloaded:  325 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Tue Jul 06, 2004 8:14 am   Post subject: (No subject)

pretty nifty if we fix some of these issues.

the pressing shift key is when you do Pic.Scale, essentially, you are creating a new picture, and Turing only allows so many pictures to be created. So you are suppose to do Pic.Free () to free up the memory, then this problem will disappear.

to draw the picture by it's center, all you have to do is a little manipulation. instead of drawing the picture like this

Pic.Draw (picID, x, y, picMerge)

do something like this:

Pic.Draw (earth, -1 * (Pic.Width (earth) div 2) + x, -1 * (Pic.Height (earth) div 2) + y, picMerge)

this will draw the picture from the center, at location x, y.

for checking if it pass left or right, do a angle check and direction check. Say if the angle from the center of your ship to the earth is 90 degrees to 0 degrees, then it's on your left, if it's 0 degrees to -90 degrees, then it's on your right (assuming you set the 0 degree line to be the direction your ship is pointing to)

of course, you need to check special cases, such as if the the ship hits head-on with the planets, but that should just be collision detection.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: