
-----------------------------------
upthescale
Sat May 06, 2006 10:06 pm

Shootins problems
-----------------------------------
Ok i have just recently started a shooting game...about an hour ago hhah and my problem is when i shoot, the deteftion is good (whatdotcolor is the most amazing and most efficient way of detections) but you can hold the mouse down and keep shooting, how can ido it so once you click o nthe mouse, it will only shoot once, adn that's it...the user then has to elt go and click again?


Thanks in advance

robbie

(p.s , when you are talkign about flash, that is action script, or java what is turing called? the language? Dos?)

-----------------------------------
TheOneTrueGod
Sat May 06, 2006 10:22 pm


-----------------------------------
First of all, whatdotcolour is only one way of detection.  There are many more efficient and more amazing ways of detection (if implemented properly) (And i'm sure andy would love to argue that with me :P)

Anyways, on to your question.  You need an "oldbutton" variable. This would keep track of what the buttonclick was last time through the main loop, eg:


var x,y,button,oldbutton : int
button := 0
loop
   oldbutton := button
   mousewhere(x,y,button)
   if button = 1 and oldbutton = 0 then %If they clicked this time through the loop, and not last time, then...
         DO STUFF HERE
   end if
end loop


-----------------------------------
upthescale
Sat May 06, 2006 10:26 pm


-----------------------------------
man u are a genious hah thanks alot my program shud be good cuz i learned arrays and wdt!!!!

-----------------------------------
Delos
Sat May 06, 2006 10:29 pm


-----------------------------------
 (And i'm sure andy would love to argue that with me :P)

Hardly ;).  In a recent post, the whatdotcolour warrior revealed why it is that he garnered himself that name:


...my obsession with whatdotcolour has nothing to do with "taking the easy way" but rather thinking abstractly...


He also had the interesting anecdote of:


...collision detection whatdotcolor is for noobs... unless you're talking about masking irregular shapes...


Anyhow.  Back on topic.  The 'oldmouse' technique works fine.  You could, however, look into Mouse.ButtonMoved() and Mouse.ButtonWait().  You'll be surprised how much the Turing Help (F10) can tell you.  I'm glad to see you've finally started taking some initiative and learning new things.  Keep plugging away.

-----------------------------------
upthescale
Sat May 06, 2006 10:32 pm


-----------------------------------
sorry but it doesn't work this is what i have inside my loop, inside my for statment:


   oldbutton := b




        if whatdotcolor (x, y) = 90 and b = 1 and oldbutton = 0 then
            randint (people (i).peoplex, 120, 1070)
            randint (people (i).peopley, 670, 670)
            kills += 1
        end if



-----------------------------------
TheOneTrueGod
Sat May 06, 2006 10:53 pm


-----------------------------------
You have to put the oldbutton := b  ***BEFORE*** the Mouse.Where, otherwise theres no point to having it. (Because code goes linearly...) Alternatively, investigate the concepts delos explained.

-----------------------------------
upthescale
Sat May 06, 2006 10:56 pm


-----------------------------------
then varaible wil haev no value!!!!!

-----------------------------------
upthescale
Sat May 06, 2006 10:58 pm


-----------------------------------
Truly sorry for spamming, therei sno edit button...but i got it thx man 10 bits (w/e they are) lol
