-- boardgame.demo - this illustrates a simple board game -- with spinner, 3 players, and movement through squares -- makes who player = 1 by default -- sets up list pos to keep track of where people are -- default postions are 1,1,1 on startmovie global pos, who pos = [1,1,1] who = 1 end --spin picks random number between 2 amd 18 -- each turn is 1/8 of circle (45') -- mod 360 reduces it all to values below 360 --repeat routine moves spinner through each position -- if statements match position with number pointed to -- spin is called by member script on spinner on spin global change, pos,who r = random(16)+2 repeat with n = 0 to r ro = (n*45) mod 360 sprite(18).rotation = ro updatestage delay 20 end repeat if ro = 0 then change = 0 if ro = 45 then change = 1 if ro = 90 then change = 2 if ro = 135 then change = 3 if ro = 180 then change = 4 if ro = 225 then change = 5 if ro = 270 then change = 6 if ro = 315 then change = 7 end -- move gets the current position of each player -- (indicated by who) gets it out of pos list -- then picks which sprite to move -- in this case sprite 13 is 1, 14 is 2, and 15 is 3 -- whosp thus is who plus 12 to adjust for which sprites -- tar is what position they are moving to -- current postion (pos1) + change selected from spinner -- repeat loop moves from pos1 to tar -- moving the player to each position -- relies on all the positions being sprite 1 to 12 -- delay slows it so it can be seen -- curpos gets where they were, adds change to it, and -- puts it back in the pos list - for example pos =[1,5,3] on moveit global change, who,pos pos1 = getat(pos,who) whosp = who+12 tar = pos1+change if tar > 12 then tar = 12 repeat with n = pos1 to tar sprite(whosp).loc = sprite(n).loc updatestage delay 30 end repeat curpos = getat(pos,who) curpos = curpos + change setat(pos,who,curpos) end -- this routine is tied to all the radio buttons -- it turns off the ones that are not chosen -- relies on a script tied to each radio button -- that sets who = value and then calls setradiobut routine on setradiobut global who member(21).hilite=0 member(22).hilite=0 member(23).hilite=0 if who = 1 then member(21).hilite = 1 if who = 2 then member(22).hilite = 1 if who = 3 then member(23).hilite = 1 end -- this delays by starting a timer -- and doing repeat loop until the timer -- reaches q on delay q starttimer repeat while the timer < q end repeat end