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

Username:   Password: 
 RegisterRegister   
 PLS HELP ME GET RID OF ASTEROIDS
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
fabulos




PostPosted: Sun May 01, 2005 10:12 am   Post subject: PLS HELP ME GET RID OF ASTEROIDS

This is the first game i'm making, and i've come across a major problem. I can't seem to get rid of the asterod. What it did was that method where it checks the distance between the x-radius and the laser, and when its less than the radius of the circle (the distance of the laser and the radius of the cirlce is less is less than the actual circle) then it does whatever...(basicalliy recognizes it).

I can't seem to make this happen so can someone please help me with this.

Also i have some useless stuff in there, so please don't mind those.

ThAnKs



space3.zip
 Description:
2 .bmp files, and 1 is the code.

Download
 Filename:  space3.zip
 Filesize:  4.02 KB
 Downloaded:  114 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
jamonathin




PostPosted: Mon May 02, 2005 6:03 am   Post subject: (No subject)

What you could do is use whatdotcolor to check if the asteroid was hit, but I wouldn't, since the lasers are the same color as the stars. So what you can do is use a for loop.

Turing:

for i : y1 + 45 .. y1 + 600 by 5
     if u+10 >= x2 and x+10 <= x2 + (width of pic) and i >=y2 and i <= y2 + (height of pic) then
         y2 := maxy + 10
         score += 1%or whatever
      end if %Repated for both asteroids and boths lasers
end for

The reason i goes by 5 is to speed things up, you could probabily make it run by 10 also. All I'm doing is checking every 5 pixels of the left laser to see if it hit the left asteroid, then moving the asteroid back up to the top (thats where you randomize the x2 again) and adding to whatever score you have. If you want to take up less lines, try putting everything into an array, and use a for loop to check everything.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: