local sMoving, sAccelStartTime on startLoop ## Starts responding to the game loop and resets script locals if sMoving is not true then put true into sMoving put the millisecs into sAccelStartTime end if end startLoop on stopLoop ## Stop responding to the game loop put false into sMoving end stopLoop on mouseDown put the millisecs into sAccelStartTime end mouseDown on mouseUp put the millisecs into sAccelStartTime end mouseUp on updateScreen ## Check if the screen should be updated if sMoving is true then put the millisecs - sAccelStartTime into tTimeSinceChange put 9.81 * ((tTimeSinceChange / 1000)^2) into tMoveAmount ## roughly simulate gravity, assuming one pixel is equal to one metre ## Update the game state if the mouse is not down then ## If the mouse is not being pressed, the rocket should fall set the icon of button "rocket" to 65600 # i.e., the ID of image "rocket-noflame.png" if (the bottom of button "rocket" + tMoveAmount) < the bottom of this card then set the bottom of button "rocket" to the bottom of button "rocket" + tMoveAmount end if else ## otherwise it should rise set the icon of button "rocket" to 65601 # i.e., the ID of image "rocket-flame.png" if (the top of button "rocket" - tMoveAmount) > the top of this card then set the top of button "rocket" to the top of button "rocket" - tMoveAmount end if end if else # (if sMoving is false) set the icon of btn "rocket" to 65600 # set back to no flame image end if end updateScreen