
-----------------------------------
Mystique
Sat May 06, 2006 2:59 pm

Whack a mole
-----------------------------------
Hi!

For my ISU, i want to make a whack a mole program, but the only problem is i don't know how to make the mouse click the mole and store it in the program so that it can keep track of the points :oops: . Anyhelp will be appreciated a lot  :D

-----------------------------------
Cervantes
Sat May 06, 2006 3:18 pm


-----------------------------------
To work with mouse input, use Mouse.Where.

Apart from that, you'll need to be more specific in your question.

-----------------------------------
Mystique
Fri May 12, 2006 5:50 pm


-----------------------------------
Thanks for the help Cervantes, I did not know about Mouse.Where :oops: 

But now i have a new problem :( In my program, I have 6 holes located on the screen, and from this holes I want the moles to come out of them and then disappear back in the hole randomly. 

The moles I'm using have been done by using turing. I don't know how to make the moles come in and out without keep on drawing a new picture. How would i do the moles popping in and out, without drawing new images?

I hope this question is a bit more clear.

-----------------------------------
HellblazerX
Fri May 12, 2006 6:33 pm


-----------------------------------
You could use Sprites in your program, and when you want a mole to disappear, use hide, and use show when you want the mole to reappear.

-----------------------------------
Mystique
Fri May 12, 2006 6:55 pm


-----------------------------------
sprites?!?!?!, i never heard of those (there is so much im finding out here than in skl). i looked it up in the turing directory thing, and tried to run it and got an error message.  :cry: . is there any other method than using sprites?

-----------------------------------
Clayton
Fri May 12, 2006 8:50 pm


-----------------------------------
unfortunately not really, unless you want to make a procedure to randomly hide a mole, and randomly show a mole, check the Turing Walkthrough if you are having any problems that you dont understand, good luck :D

-----------------------------------
TheOneTrueGod
Fri May 12, 2006 9:50 pm


-----------------------------------
yarr... sprites are all but worthless in turing from what I have heard (never bothered to use them, allways create my own :P)

First of all, consider learning arrays and records, in order to keep your code easy to use and understand.  These can be found in the [Turing Walkthrough].  Once you have learnt these, have an activation flag for each mole.  That is to say, have a boolean that is true if the mole is active, and false if the mole isn't.  If the mole is active, you can either just draw it as out, or you can have it slowly pop out of the hole.  I'd suggest you start with it just appearing, and then if you feel like it, work from there.

-----------------------------------

Fri May 12, 2006 10:34 pm

Possibility
-----------------------------------
What I would do is use a rand.int or something, and make the mole appear and use counters to move it up then back down, then clear him or something. Then a combo with Mouse.Where and Whatdotcolour you can tell if you click a mole. I bet someone is going to bash my reply because I'm new to these forums and someone will say "DO NOT USE WHATDOTCOLOUR ITS COLLISION DETECTION SUCKS!"

-----------------------------------
TheOneTrueGod
Sat May 13, 2006 9:16 am


-----------------------------------
Erm, generally anyone who replies in all caps like that is a troll/idiot and should be ignored, but eh.  Whatdotcolour collision doesn't suck.  It has its uses, but for this case, I would have to disagree that whatdotcolour is a good thing.  To be able to use it effectively, he would have to colour each mole a different colour (In order to determine which mole was whacked when), and how many brightpurple moles do you see running around  :wink: 

For this project, It would probably be better to use a square based collision detection, depending on how they are shaped, and depending on if the game is top-down view, or facing from the front.  The other option is circular detection.

square based detection is simply:

 if mx >= leftside and mx = bottom and my 