|
on mouseUp --
only go to new frame after 3 clicks --
on any of the buttons - assume 3 buttons --
make a variable called cc --
to keep count --
make it global so all parts of movie --
can access it
global cc
beep
-- add 1 to whatever cc was
cc=cc+1
-- check if cc is greater than 3
-- that means buttons were clicked 3 times
if cc > 3 then
-- go to new frame - after 3 clicks
go frame "prize"
-- reset cc
cc = 0
end if end |
- on mouseUp
-- only go after each of 3 buttons
-- were each clicked
- assumes 3 different buttons
-- each has variable associated
-- this example is for the red button
-- r gets changed here
-- other buttons would be the same
-- except different variable would be changed
-- make r,g,b variables global so all movies
-- can talk to them
global r,g,b
beep
-- change r to 1
r = 1
-- check if r, g, and b are = 1
-- that would only be true if each button
-- had been clicked at least once
if r=1 and g=1 and b=1
-- go to new frame - after clicks on each
go frame "prize"
-- reset r, b, & b
r=0
g=0
b=0
end if end |
on mouseUp -- only play
sound if sound in channel 1
-- is done - soundbusy = 0 when done
if soundbusy(1) = 0 then
sound(1).play(member("test"))
end if end on exitframe me
-- needs to be placed in all frames
-- to test at each frame
-- sound activates only when 2 sprites touch
-- these are rectangles around sprites
r1 = sprite(1).rect
r2 = sprite(2).rect
-- intersect tests if 2 rectangles are touching
-- if they touch then it activates inner if test
-- the innter test plays the sound if it is not -- already playing
-- when finally intersect wont' be rect(0000)
if intersect(r1, r2) <> rect(0,0,0,0) then
if soundbusy(1) = 0 then
sound(1).play(member("test"))
end if
end if end --alternate to check if inside of r2 --if union(r1, r2) =r2
|