global gameisRunning
set the bottom of btn "bird" to the bottom of btn "bird" + birdDirection
set the right of btn "city01" to the right of btn "city01" -4
if the right of btn "city01" < 0 then
set the left of btn "city01" to the right of btn "city02" -4
set the right of btn "city02" to the right of btn "city02" -4
if the right of btn "city02" < 0 then
set the left of btn "city02" to the right of btn "city01" -4
send moveBird to me in 20 millisecs
// move the top and bot columns together
set the right of btn ("top"& i ) to the right of btn ("top"& i ) -5
set the right of btn ("bot"& i ) to the right of btn ("bot"& i ) -5
// if they go off the page
if the right of btn ("top"& i ) < 0 then
// start them again at the right side of the card
set the left of btn ("top"& i ) to the right of card "main" -5
set the left of btn ("bot"& i ) to the right of card "main" -5
// generate a random number between 1 and 100
put random(100) into newloc
// set the pipes to start at that new location
set the bottom of btn ("top"& i ) to 180+newLoc
set the top of btn ("bot"& i ) to 350+newLoc
// We do this in a loop using nymbers 1 to 4
// check bird intersect with top1, top2, top3, top4
if intersect(btn "bird" , btn ("top"&i), 255 ) then
// check bird intersect with bot1, bot2, bot3, bot4
if intersect(btn "bird" , btn ("bot"&i), 255 ) then
put true into gameisRunning
put +5 into birdDirection
put false into gameisRunning
set the bottom of btn "bird" to 300
put -5 into birdDirection
put +5 into birdDirection
|
|