--------------------------------------------------------------- Code to put on Card Script ----- global gameRunning ------------------------------------- on startGame put true into gameRunning gameLoop end startGame on stopGame put false into gameRunning end stopGame -------------------------------------- on gameLoop moveBackground moveEnemies checkForCollisions updateTimer if gameRunning then send gameLoop to me in 2 ticks end if end gameLoop ----------------------------------------------- on moveBackground // add your code here to move the background end moveBackground on moveEnemies set the left of button "enemy" to the left of button "enemy" - 5 if the right of button "enemy" < 0 then set the left of button "enemy" to the right of card "card 1" end if end moveEnemies on checkForCollisions if intersect (button "box", button "enemy") then stopGame set the loc of button "box" to 50,50 answer "You lose, Play again" with "No" or "Yes" if it is "yes" then startGame end if end if end checkForCollisions on updateTimer // add your code here to update the timer end updateTimer ---------------------------------------------------------------------------------- on arrowkey x if x is "up" then set the top of button "box" to the top of button "box" - 10 if top of button "box" < 0 then set the top of button "box" to 0 end if end if if x is "down" then set the bottom of button "box" to the bottom of button "box" + 10 if the bottom of button "box" > the bottom of card "card 1" then set the bottom of button "box" to the bottom of card "card 1" end if end if if x is "left" then set the left of button "box" to the left of button "box" - 10 if the left of button "box" < 0 then set the left of button "box" to 0 end if end if if x is "right" then set the right of button "box" to the right of button "box" + 10 if right of button "box" > the right of card "card 1" then set the right of button "box" to the right of card "card 1" end if end if end arrowKey ------------------------------------------- |
Home >