REVO2700 space-game@q 5 Space Game ULucida Grande WLucida GrandecREVGeometryCachestackID1012 cREVGeneralbreakpointconditions breakpointsbreakpointstatesstackfileversion2.7 P 8local sGameRunning local sGameStartTime local sLastFrameTimeComplete local sXVelocity local sYVelocity on preOpenStack set the compositortype of this stack to "coregraphics" set the compositorcachelimit of this stack to 32 * 1024 * 1024 set the compositortilesize of this stack to 32 put 1 into sXVelocity put 1 into sYVelocity backgroundSetup gameStart end preOpenStack on gameStart put true into sGameRunning put the milliseconds into sGameStartTime put the milliseconds into sLastFrameTimeComplete if sXVelocity is 0 then put 0.6 into sXVelocity if sYVelocity is 0 then put 0.6 into sYVelocity gameLoop end gameStart on gameStop put false into sGameRunning end gameStop on gameLoop lock screen put the milliseconds - sLastFrameTimeComplete into tElapsedTime shipMove tElapsedTime shipCheckBounds unlock screen if sGameRunning then put the milliseconds into sLastFrameTimeComplete send "gameLoop" to me in 15 milliseconds end if end gameLoop on shipMove pTime if pTime > 0 then --set the left of graphic "ship" to the left of graphic "ship" + 10 --set the top of graphic "ship" to the top of graphic "ship" + 3 put item 1 of the loc of graphic "ship" into tX put item 2 of the loc of graphic "ship" into tY add sXVelocity * pTime to tX add sYVelocity * pTime to tY --put return & sYVelocity after msg --put sXVelocity & " * " & pTime & return & tX & comma & tY set the loc of graphic "ship" to tX & comma & tY end if end shipMove on shipCheckBounds put item 1 of the loc of graphic "ship" into tXLoc put item 2 of the loc of graphic "ship" into tYLoc put the width of graphic "ship" / 2 into tMinX put the height of graphic "ship" / 2 into tMinY put the width of this stack - (the width of graphic "ship" / 2) into tMaxX put the height of this stack - (the height of graphic "ship" / 2) into tMaxY if tXLoc < tMinX then put tMaxX into tXLoc else if tXLoc > tMaxX then put tMinX into tXLoc end if if tYLoc < tMinY then put tMaxY into tYLoc else if tYLoc > tMaxY then put tMinY into tYLoc end if set the loc of graphic "ship" to tXLoc & comma & tYLoc end shipCheckBounds on backgroundSetup set the rect of graphic "background" to the rect of this stack set the left of graphic "background" to 0 set the top of graphic "background" to 0 end backgroundSetup on arrowkey pKey if pKey is "up" then subtract 0.2 from sYVelocity else if pKey is "down" then add 0.2 to sYVelocity else if pKey is "right" then add 0.2 to sXVelocity else if pKey is "left" then subtract 0.2 from sXVelocity end if if sYVelocity > 1 then put 1 into sYVelocity else if sYVelocity < -1 then put -1 into sYVelocity end if end arrowkey local sDragStartX local sDragStartY on mouseDown put item 1 of the mouseLoc into sDragStartX put item 2 of the mouseLoc into sDragStartY end mouseDown on mouseRelease put item 1 of the mouseLoc into sDragEndX put item 2 of the mouseLoc into sDragEndY put sqrt(sDragEndX^2 + sDragStartX^2 - (2 * sDragEndX * sDragStartX) * cos(sDragEndY + sDragEndX)) end mouseRelease on mouseUp mouseRelease end mouseUp cREVGeometryCacheIDs13221531650681003132215333301910041323341756792101213221535284551006cREVGeometrycacheorder total4 cREVGeneralscripteditorvscroll1354scripteditorselection3342 backgroundK@ cREVGeneral revUniqueID 1322153165068shipKD+,h cREVGeneral revUniqueID 1322153333019scripteditorvscroll0scripteditorselection0startepon mouseUp if the label of me is "Start" then gameStart set the label of me to "Stop" else gameStop set the label of me to "Start" end if end mouseUp R0Start cREVGeneral revUniqueID 1322153528455scripteditorvscroll0scripteditorselection96  Label Field f cREVTable currentview^Simple space simulation. Ball Never leaves the screen. Array keys control direction and speed. cREVGeneral revUniqueID 1323341756792 _Simple space simulation. Ball Never leaves the screen. Array keys control direction and speed. revOnline | RunRev