--========demonstrates capture game script -- get points by moving circle into square -- 20 second time limit -- initialize values on startmovie global score score = 0 tiused = 0 end -- 0 scdore, set start, activate goflag on newgame global score,star, goflag score = 0 goflag = 1 star = the ticks end -- put target at random, circle at start on newtarget x = random(600) + 40 y = random (400) + 80 sprite(1).loc =point(x,y) sprite(2).loc = point(125,30) updatestage end -- check if circle within -- if it is give point and set new target on testintersection global score if sprite(2).within(1) then score = score+1 put score into member("sco") newtarget beep end if end -- compute how much time used & put in box -- if over 20, end game, goflag = 0 on update global tiused, star, goflag tiused = (the ticks - star)/60.0 put tiused into member ("tim") testintersection if tiused > 20 then goflag = 0 end if end --===================demostrates - card section -- this creates a list of all cards called deck -- a list is formed by brackets and comma separators -- it then creates a copy of the deck to work with called tempdeck -- it then gets 5 random cards and puts them into list called player 1 -- it appends them to the lists for each player (append player1,xxx) -- each time it picks a card if deletes it out of tempdeck so it can't be used again -- deleteat(tempdeck,xxx) on shuffle global deck, player1,player2,bluescore,redscore bluescore = 0 redscore = 0 put "" into member ("winner") deck = [#s1,#s2,#s3,#s4,#s5,#s6,#s7,#s8,#s9,#s10,#s11,#s12,#s13,\ #h1,#h2,#h3,#h4,#h5,#h6,#h7,#h8,#h9,#h10,#h11,#h12,#h13,\ #c1,#c2,#c3,#c4,#c5,#c6,#c7,#c8,#c9,#c10,#c11,#c12,#c13,\ #d1,#d2,#d3,#d4,#d5,#d6,#d7,#d8,#d9,#d10,#d11,#d12,#d13] tempdeck = deck player1=[] repeat with n = 1 to 5 dd = tempdeck.count r = random(dd) r1 = getat(tempdeck,r) append (player1,r1) deleteat(tempdeck,r) end repeat player2=[] repeat with n = 1 to 5 dd = tempdeck.count r = random(dd) r1 = getat(tempdeck,r) append (player2,r1) deleteat(tempdeck,r) end repeat end -- rotatecards makes them spin around -- then it grabs the first card in each players list -- it puts them in field so we can see them -- it then deletes it out of each players hand -- if checks if it has done 5 cards and makes it over -- it calls testwinner to see who won on rotatecards global player1, player2,rr,bb repeat with n = 1 to 72 sprite(4).rotation = n*10 sprite(5).rotation = n*10 updatestage end repeat rc = player1.count bc = player2.count if rc > 0 then rr = getat(player1,1) put rr into member ("redcard") deleteat (player1,1) bb = getat(player2,1) put bb into member ("bluecard") deleteat (player2,1) testwinner else put "gameover" into member("winner") end if end -- testwinner gets rid of the letter that is part of each cards name -- it then converts them to numbers with the integer function -- it then sees who won -- and adds to the score of the winner on testwinner global bb,rr,bluescore,redscore put "" into char 1 of bb put "" into char 1 of rr bbx = integer(bb) rrx = integer(rr) if bbx > rrx then put "blue wins" into z bluescore = bluescore+1 put bluescore into member ("bscore") end if if rrx > bbx then put "red wins" into z redscore = redscore+1 put redscore into member ("rscore") end if if bbx = rrx then put "tie" into z end if put z into member ("winner") end