Computer Science Canada

Mousecommand help

Author:  MOUSECORD [ 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]

Author:  aside [ Fri Jun 11, 2004 6:51 am ]
Post 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.

Author:  MOUSECORD [ Fri Jun 11, 2004 8:28 am ]
Post subject: 

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

Author:  MOUSECORD [ Fri Jun 11, 2004 8:43 am ]
Post subject: 

i still need help with whatdotcolor lol

Author:  aside [ Fri Jun 11, 2004 11:48 am ]
Post 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, .....)



Author:  MOUSECORD [ Fri Jun 11, 2004 1:00 pm ]
Post 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?

Author:  aside [ Fri Jun 11, 2004 4:10 pm ]
Post subject: 

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

Author:  Jodo Yodo [ Fri Jun 11, 2004 10:15 pm ]
Post 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.

Author:  TheZsterBunny [ Mon Jun 14, 2004 7:56 pm ]
Post 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


: