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

Username:   Password: 
 RegisterRegister   
 Mousecommand help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
MOUSECORD




PostPosted: Thu Jun 10, 2004 10:16 pm   Post subject: Mousecommand help

okay i'm making this program (missile command) and where when you click with your mouse it explodes and implodes you know missile command right well when i do it.... it dosn't stay in one spot... meaning if i move the mouse it follows it around and you ahve to hold the mouse click down does anyone know how to stop this from happening... (no loops or for loops, only if statements)[/code]
Sponsor
Sponsor
Sponsor
sponsor
aside




PostPosted: Fri Jun 11, 2004 6:51 am   Post subject: (No subject)

you were checking the mouse value constantly, and in your program, the centre of the explosion is the mouse value, so it will change as the mouse goes. so set another pair of variables to hold the original mouse value.
MOUSECORD




PostPosted: Fri Jun 11, 2004 8:28 am   Post subject: (No subject)

okay yeah i see where you are coming from how do u go about doing this?
MOUSECORD




PostPosted: Fri Jun 11, 2004 8:43 am   Post subject: (No subject)

i still need help with whatdotcolor lol
aside




PostPosted: Fri Jun 11, 2004 11:48 am   Post subject: (No subject)

add this to the program:

code:

var cex, cey:int


then change if button is clicking

code:

mousewhere (mousex, mousey, button)
if button=1 then
cex:=mousex
cey:=mousey
end if

then change the drawing part

code:

drawfilloval (cex, cey, .....)


MOUSECORD




PostPosted: Fri Jun 11, 2004 1:00 pm   Post subject: (No subject)

yeup thx i got it now all i gotta do if make it so when the white of the missile hits the red of the anti missile the missile ends got ne insite?
aside




PostPosted: Fri Jun 11, 2004 4:10 pm   Post subject: (No subject)

assume that you already have the variables of the positions of the missile and anti-missile. check whatdotcolour.
Jodo Yodo




PostPosted: Fri Jun 11, 2004 10:15 pm   Post subject: (No subject)

If the entire missiles are coloured white and red respectively, then you shouldn't use whatdotcolour detection since it su><orz. Perhaps the circle detection system, using cosine and sine, would be better, but it depends on the shape of your missiles.
Sponsor
Sponsor
Sponsor
sponsor
TheZsterBunny




PostPosted: Mon Jun 14, 2004 7:56 pm   Post subject: (No subject)

JY, whatare you talking about

The only potential problem i can forsee is if you have the same color for your explosions.

what you could do, is have circular detection and whatdotcolor.

it doesn't even have to be circular

if the mouse is close to the coord of the missile, and the mousecolor is the missle, then a city is saved.

I remember that game.

-Z
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  [ 9 Posts ]
Jump to:   


Style:  
Search: