Computer Science Canada Whack-A-Mole |
Author: | mmcdough [ Wed Jun 06, 2007 9:39 pm ] |
Post subject: | Whack-A-Mole |
I am making a Whack-A-Mole game...lol. I made 9 procedures for the heads that pop out of the holes. But now I am stuck because I don't know how to make them randomly pop up. Thanks. |
Author: | isaiahk9 [ Wed May 07, 2008 5:41 pm ] |
Post subject: | RE:Whack-A-Mole |
Why would you make a procedure for each head? I don't quite get it. Anyway, why don't you just make a random variable that will call upon a head: loop Var whathead r := Rand.Int (1,9) If whathead = 1 then headone elsif whathead = 2 then headtwo elsif whathead = 3 then headthree elsif whathead = 4 then headfour elsif whathead = 5 then headfive elsif whathead = 6 then headsix elsif whathead = 7 then headseven elsif whathead = 8 then headeight else headnight end if end loop |
Author: | S_Grimm [ Fri May 09, 2008 11:27 am ] |
Post subject: | RE:Whack-A-Mole |
I agree with isaiak9. the randint would be the easist way. though you could probably get away with one procedure for each head. use different variables for the x,y coordinates of each head and call the co-ordinates for each.. loop Var whathead r := Rand.Int (1,9) If whathead = 1 then x := 1 y := 1 headone elsif whathead = 2 then x:= 2 y:=2 headtwo etc. etc. etc. |