`************** DiNGo DaNGo
`***************** By Jimmy
 
SYNC ON : SYNC RATE 40 : HIDE MOUSE
 
DIM Moves(8) as String
 
Moves(0) = ""
Moves(1) = "Forward 1"
Moves(2) = "Forward 2"
Moves(3) = "Forward 3"
Moves(4) = "Rotate Left"
Moves(5) = "Rotate Right"
Moves(6) = "Rotate 180"
Moves(7) = "Backward 1"
 
 
scrW = SCREEN WIDTH()
 
Make_Robot(100)
SCALE OBJECT 100, 50, 50, 50
INK RGB(255, 255, 255), RGB(0, 0, 0)
 
MAKE OBJECT CUBE 1, 5
COLOR OBJECT 1, RGB(100, 100, 100)
 
MAKE OBJECT CUBE 2, 5
COLOR OBJECT 2, RGB(0, 0, 200)
 
MAKE OBJECT CUBE 3, 5
COLOR OBJECT 3, RGB(0, 200, 0)
 
MAKE OBJECT CUBE 4, 5
COLOR OBJECT 4, RGB(0, 0, 0)
 
MAKE OBJECT CUBE 5, 5
COLOR OBJECT 5, RGB(255, 0, 0)
 
MAKE OBJECT CUBE 6, 3
COLOR OBJECT 6, RGB(255, 255, 0)
 
MAKE OBJECT CUBE 7, 5
COLOR OBJECT 7, RGB(255, 0, 255)
 
FOR i=1 TO 7
   HIDE OBJECT i
NEXT i
 
`MAKE OBJECT SPHERE 100, 4
`COLOR OBJECT 100, RGB(255, 255, 0)
MAKE OBJECT CONE 101, 2
COLOR OBJECT 101, RGB(255, 155, 0)
HIDE OBJECT 101
 
CurLevel = 0
 
NEWLEVEL:
 
GOSUB LoadNextLevel
 
RESTART:
 
PPosX# = blueJ*5.4
PPosZ# = blueI*5.4
PAng# = 0
OAng# = 0
CamHeight# = 15.0
curMove = 0
camx = levW*-1
camz = levW*-1
POSITION CAMERA camx, CamHeight#, camz
POINT CAMERA (levW*5.4)/2, 0, (levH*5.4)/2
Page = 1
QPage = 1
DO
   `CONTROL CAMERA USING ARROWKEYS 0, 1, 1
   POSITION OBJECT 100, PPosX#, 2, PPosZ#
   POSITION OBJECT 101, PPosX#, 2, PPosZ#
   YROTATE OBJECT 100, PAng#
   ROTATE OBJECT 101, 0, 0, 0
   YROTATE OBJECT 101, PAng#
   MOVE OBJECT 101, 2.5
   XROTATE OBJECT 101, 90
 
 
 
   TEXT 5, 5, "Available Moves"
   Count = 0
   FOR i = ((Page-1)*26)+1 TO ((Page-1)*26)+26
      INC Count
      TEXT 5, Count*11+10, CHR$(96+Count)+": "+Moves(levelMoves(i))
      IF i = numMoves THEN i = ((Page-1)*26)+27
   NEXT i
   TEXT 5, 26*11+30, "Page "+STR$(Page)+" of "+STR$(TPages)
   TEXT scrW-140, 5, "Queued UP Moves"
 
   IF QPage <= TPages
   Count = 0
   FOR i = ((QPage-1)*26)+1 TO ((QPage-1)*26)+26
      INC Count
      IF i = (CurMove-1) THEN INK RGB(255, 255, 0), RGB(0, 0, 0)
      TEXT scrW-140, Count*11+10, CHR$(64+Count)+": "+Moves(qMoves(i))
      INK RGB(255, 255, 255), RGB(0, 0, 0)
      IF i = numMoves THEN i = ((QPage-1)*26)+27
   NEXT i
   TEXT scrW-140, 26*11+30, "Page "+STR$(QPage)+" of "+STR$(TPages)
   ENDIF
 
      POSITION CAMERA camx, CamHeight#, camz
      POINT CAMERA (levW*5.4)/2, 0, (levH*5.4)/2
      IF KEYSTATE(203) = 1 AND leftDown = 0
         PAng# = WRAPVALUE(PAng#-90)
         leftDown = 1
      ENDIF
      IF KEYSTATE(203) = 0 AND leftDown = 1 THEN leftDown = 0
 
      IF KEYSTATE(205) = 1 AND rightDown = 0
         PAng# = WRAPVALUE(PAng#+90)
         rightDown = 1
      ENDIF
      IF KEYSTATE(205) = 0 AND rightDown = 1 THEN rightDown = 0
 
      IF KEYSTATE(200) = 1 AND CamHeight# > 5 THEN DEC CamHeight#, 0.5
      IF KEYSTATE(208) = 1 AND CamHeight# < 95 THEN INC CamHeight#, 0.5
 
         `ConvAng# = WRAPVALUE(PAng#)
         `GOSUB GetCurSquare
         `GOSUB GetNextSquare
         `GOSUB GetPrevSquare
      CENTER TEXT scrW/2, 5, "DiNGo DaNGo!!"
      CENTER TEXT scrW/2, 21, "LEVEL: "+STR$(CurLevel)+" - '"+MapName$+"'"
 
 
 
   IF Running = 1
      IF OnRotator = 1 THEN OAng# = WRAPVALUE(OAng#+2.0)
      IF OnConvey = 1 THEN OAng# = WRAPVALUE(OAng#+(90.0/54.0))
      FOR i = 1 TO levH
         FOR j = 1 TO levW
            obj = level(i, j)
            IF OnRotator = 1 OR OnConvey = 1
               IF obj = 5 THEN YROTATE OBJECT levelObj(i, j), OAng#
               IF obj = 11 THEN YROTATE OBJECT levelObj(i, j), OAng#*-1
               IF obj = 7 THEN XROTATE OBJECT levelObj(i, j), OAng#
               IF obj = 8 THEN XROTATE OBJECT levelObj(i, j), OAng#*-1
               IF obj = 9 THEN ZROTATE OBJECT levelObj(i, j), OAng#
               IF obj = 10 THEN ZROTATE OBJECT levelObj(i, j), OAng#*-1
            ELSE
               OAng# = 0
               IF obj = 5 THEN YROTATE OBJECT levelObj(i, j), 0
               IF obj = 11 THEN YROTATE OBJECT levelObj(i, j), 0
               IF obj = 7 THEN XROTATE OBJECT levelObj(i, j), 0
               IF obj = 8 THEN XROTATE OBJECT levelObj(i, j), 0
               IF obj = 9 THEN ZROTATE OBJECT levelObj(i, j), 0
               IF obj = 10 THEN ZROTATE OBJECT levelObj(i, j), 0
            ENDIF
         NEXT j
      NEXT i
      QPage = (CurMove/27)+1
      IF Stopped = 1
         ConvAng# = WRAPVALUE(PAng#)
 
         GOSUB GetCurSquare
         GOSUB GetNextSquare
         GOSUB GetPrevSquare
 
         tSquare = curSquare
         IF Action = 0
            IF OnConvey = 1 THEN OnConvey = 0 : curSquare = 0
            IF curSquare > 6 AND curSquare < 11
               IF curSquare = 7 THEN ConvAng# = 0
               IF curSquare = 8 THEN ConvAng# = 180
               IF curSquare = 9 THEN ConvAng# = 270
               IF curSquare = 10 THEN ConvAng# = 90
               GOSUB GetNextSquare
               GOSUB GetPrevSquare
               Action = 1
               OnConvey = 1
            ENDIF
            IF OnRotator = 1 THEN OnRotator = 0 : curSquare = 0
            IF curSquare = 5 THEN OnRotator = 1 : Action = 5
            IF curSquare = 11 THEN OnRotator = 1 : Action = 4
         ENDIF
         IF Action = 0 AND curMove > numQMoves AND OnConvey = 0
            IF tSquare = 3
               GOSUB UnloadLevel
               GOSUB NEWLEVEL
            ELSE
               GOSUB GameOver
            ENDIF
         ENDIF
         IF Action = 0 AND curMove <= numQMoves THEN Action = qMoves(curMove) : INC curMove
         Stopped = 0
         Movement# = 0.0
      ELSE
         IF Action < 4 OR Action = 7
            IF Action > 0
               Tread# = 0.0
               IF Action <> 7 AND nextSquare <> 6 THEN YROTATE OBJECT 100, ConvAng# : MOVE OBJECT 100, 0.1 : YROTATE OBJECT 100, PAng# : Tread# = -0.01
               IF Action <> 7 AND nextSquare = 6 AND OnConvey = 0 THEN Action = 1 : Movement# = 5.4
               IF Action = 7 AND prevSquare <> 6 THEN YROTATE OBJECT 100, ConvAng# : MOVE OBJECT 100, -0.1 : YROTATE OBJECT 100, PAng# : Tread# = 0.01
               IF Action = 7 AND prevSquare = 6 AND OnConvey = 0 THEN Movement# = 5.4
               INC Movement#, 0.1
               IF OnConvey = 0
                  SCROLL LIMB TEXTURE 100, 4, Tread#, 0
                  SCROLL LIMB TEXTURE 100, 5, Tread#, 0
               ENDIF
               IF Movement# >= 5.3
                  Stopped = 1
                  DEC Action
                  ConvAng# = 0
                  IF Action = 6 THEN Action = 0
                  GOSUB GetCurSquare
                  GOSUB GetNextSquare
                  GOSUB GetPrevSquare
                  IF curSquare = 0 OR curSquare = 4
                     REMSTART
                     REPEAT
                        pizzle# = (OBJECT POSITION Z(100)) / 5.3
                        TEXT 5, 200, STR$(nextSquare)+":"+STR$(curSquare)+":"+STR$(prevSquare)
                        TEXT 5, 211, STR$(pNextI)+","+STR$(pNextJ)
                        TEXT 5, 222, STR$(pI)+","+STR$(pJ)
                        TEXT 5, 233, STR$(pPrevI)+","+STR$(pPrevJ)
                        TEXT 5, 244, STR$(pizzle#)
                        TEXT 5, 255, STR$(OBJECT POSITION Z(100))
                        TEXT 5, 266, STR$(Action)
                        TEXT 5, 277, STR$(Movement#)
                        TEXT 5, 288, STR$(curMove)
                        TEXT 5, 299, STR$(numQMoves)
                        SYNC
                     UNTIL KEYSTATE(30) = 1
                     REMEND
                     GOSUB GameOver
                  ENDIF
               ENDIF
            ENDIF
         ENDIF
         IF Action = 4 OR Action = 5
            IF Action = 4
               PAng# = OBJECT ANGLE Y(100)-2
               IF OnRotator = 0
                  SCROLL LIMB TEXTURE 100, 4, -0.01, 0
                  SCROLL LIMB TEXTURE 100, 5, 0.01, 0
               ENDIF
            ENDIF
            IF Action = 5
               PAng# = OBJECT ANGLE Y(100)+2
               IF OnRotator = 0
                  SCROLL LIMB TEXTURE 100, 4, 0.01, 0
                  SCROLL LIMB TEXTURE 100, 5, -0.01, 0
               ENDIF
            ENDIF
            YROTATE OBJECT 100, PAng#
            INC Movement#, 2.0
            IF Movement# >= 90.0
               Stopped = 1
               Action = 0
            ENDIF
         ENDIF
         IF Action = 6
            PAng# = OBJECT ANGLE Y(100)+2
            YROTATE OBJECT 100, PAng#
            SCROLL LIMB TEXTURE 100, 4, 0.01, 0
            SCROLL LIMB TEXTURE 100, 5, -0.01, 0
            INC Movement#, 2.0
            IF Movement# >= 180.0
               Stopped = 1
               Action = 0
            ENDIF
         ENDIF
         PPosX# = OBJECT POSITION X(100)
         PPosZ# = OBJECT POSITION Z(100)
      ENDIF
   ELSE
      OAng# = WRAPVALUE(OAng#+2.0)
 
      FOR i = 1 TO levH
         FOR j = 1 TO levW
            obj = level(i, j)
            IF obj = 5 THEN YROTATE OBJECT levelObj(i, j), OAng#
            IF obj = 11 THEN YROTATE OBJECT levelObj(i, j), OAng#*-1
            IF obj = 7 THEN XROTATE OBJECT levelObj(i, j), OAng#
            IF obj = 8 THEN XROTATE OBJECT levelObj(i, j), OAng#*-1
            IF obj = 9 THEN ZROTATE OBJECT levelObj(i, j), OAng#
            IF obj = 10 THEN ZROTATE OBJECT levelObj(i, j), OAng#*-1
         NEXT j
      NEXT i
      CENTER TEXT scrW/2, 40, "HOLD TAB TO VIEW INSTRUCTIONS"
 
      IF KEYSTATE(15) = 1
         INK RGB(0, 0, 0), RGB(0, 0, 0)
         BOX 97, 103, 545, 370
         INK RGB(255, 255, 255), RGB(0, 0, 0)
         CENTER TEXT scrW/2, 110, "GRAY SQUARES ARE PLATFORMS - OK FOR DINGO"
         INK RGB(255, 0, 0), RGB(0, 0, 0)
         CENTER TEXT scrW/2, 121, "RED SQUARES TURN YOU 90 DEG. IN THE DIR. THEY SPIN"
         INK RGB(255, 0, 255), RGB(0, 0, 0)
         CENTER TEXT scrW/2, 132, "PURPLE SQUARES PUSH YOU 1 SPACE IN THE DIR. THEY SPIN"
         INK RGB(255, 255, 0), RGB(0, 0, 0)
         CENTER TEXT scrW/2, 143, "YELLOW SQUARES SCARE DINGO, HE WILL NOT MOVE ONTO THEM"
         INK RGB(115, 115, 115), RGB(0, 0, 0)
         CENTER TEXT scrW/2, 154, "BLACK SQUARES ARE PITS OF DEATH. GAME OVER."
         INK RGB(255, 255, 255), RGB(0, 0, 0)
         CENTER TEXT scrW/2, 170, "OBJECT: GO FROM BLUE SQUARE TO GREEN SQUARE WITH THE"
         CENTER TEXT scrW/2, 181, "GIVEN MOVES. YOU MAY NEED ALL, YOU MAY NOT"
         CENTER TEXT scrW/2, 210, "USE LEFT-RIGHT ARROW KEYS TO CHOOSE STARTING DIRECTION"
         CENTER TEXT scrW/2, 221, "UP-DOWN ARROW KEYS MOVE THE CAMERA IN AND OUT"
         CENTER TEXT scrW/2, 240, "QUEUE UP YOUR DESIRED MOVES WITH THE CORRESPONDING"
         CENTER TEXT scrW/2, 251, "LETTER ON THE KEYBOARD."
         CENTER TEXT scrW/2, 270, "TO DELETE FROM THE QUEUE, HOLD SHIFT AND USE TEH"
         CENTER TEXT scrW/2, 281, "CAPITALS."
         CENTER TEXT scrW/2, 300, "USE , AND . TO FLIP THROUGH PAGES OF MOVES. HOLD SHIFT"
         CENTER TEXT scrW/2, 311, "TO FLIP THROUGH THE QUEUE'S PAGES."
         CENTER TEXT scrW/2, 330, "USE SHIFT+BACKSPACE TO CLEAR THE QUEUE."
         CENTER TEXT scrW/2, 350, "PRESS SPACE WHEN YOU ARE READY TO DIE."
      ENDIF
      Key = KeyToInt(INKEY$())
      IF Key <> 0 AND KeyDown = 0
         IF Key < 101 AND Key <= numMoves
            IF levelMoves(((Page-1)*26)+Key) <> 0
               INC numQMoves
               qMoves(numQMoves) = levelMoves(((Page-1)*26)+Key)
               qMoveKeys(numQMoves) = ((Page-1)*26)+Key
               levelMoves(((Page-1)*26)+Key) = 0
            ENDIF
         ENDIF
 
         IF Key > 100
            Key = Key - 100
            IF Key <= numQMoves
               GOSUB DeleteFromQ
            ENDIF
         ENDIF
         KeyDown = 1
      ENDIF
      IF Key = 0 AND KeyDown = 1 THEN KeyDown = 0
 
      IF KEYSTATE(51) = 1 AND CommaDown = 0
         IF KEYSTATE(54) = 0 AND KEYSTATE(42) = 0
            IF Page > 1 THEN DEC Page
         ELSE
            IF QPage > 1 THEN DEC QPage
         ENDIF
         CommaDown = 1
      ENDIF
      IF KEYSTATE(51) = 0 AND CommaDown = 1 THEN CommaDown = 0
 
      IF KEYSTATE(52) = 1 AND PeriodDown = 0
         IF KEYSTATE(54) = 0 AND KEYSTATE(42) = 0
            IF Page < TPages THEN INC Page
         ELSE
            IF QPage < TPages THEN INC QPage
         ENDIF
         PeriodDown = 1
      ENDIF
      IF KEYSTATE(52) = 0 AND PeriodDown = 1 THEN PeriodDown = 0
 
      IF KEYSTATE(14) = 1 AND BSDown = 0
         IF KEYSTATE(54) = 1 OR KEYSTATE(42) = 1
            tqPage = QPage
            QPage = 1
            tnumq = numQMoves
            Key = 1
            FOR qi = 1 to tnumq
               GOSUB DeleteFromQ
            NEXT qi
            QPage = tqPage
         ENDIF
         BSDown = 1
      ENDIF
      IF KEYSTATE(14) = 0 AND BSDown = 1 THEN BSDown = 0
 
      IF KEYSTATE(57) = 1 AND SpaceDown = 0
         Running = 1
         curMove = 1
         Stopped = 1
         SpaceDown = 1
      ENDIF
      IF KEYSTATE(57) = 0 AND SpaceDown = 1 THEN SpaceDown = 0
 
 
   ENDIF
 
   REMSTART
   pizzle# = (OBJECT POSITION Z(100)) / 5.3
   TEXT 5, 200, STR$(nextSquare)+":"+STR$(curSquare)+":"+STR$(prevSquare)
   TEXT 5, 211, STR$(pNextI)+","+STR$(pNextJ)
   TEXT 5, 222, STR$(pI)+","+STR$(pJ)
   TEXT 5, 233, STR$(pPrevI)+","+STR$(pPrevJ)
   TEXT 5, 244, STR$(pizzle#)
   TEXT 5, 255, STR$(OBJECT POSITION Z(100))
   REMEND
   `TEXT 5, 400, STR$(SCANCODE())
   SYNC
LOOP
 
DeleteFromQ:
   IF qMoves(((QPage-1)*26)+Key) <> 0
      DEC numQMoves
      levelMoves(qMoveKeys(((QPage-1)*26)+Key)) = qMoves(((QPage-1)*26)+Key)
      qMoves(((QPage-1)*26)+Key) = 0
      qMoveKeys(((QPage-1)*26)+Key) = 0
      FOR i = (((QPage-1)*26)+Key) TO numQMoves+1
         qMoves(i) = qMoves(i+1)
         qMoveKeys(i) = qMoveKeys(i+1)
      NEXT i
   ENDIF
RETURN
 
UnloadLevel:
   Running = 0
   FOR i = 1 TO levH
      FOR j = 1 to levW
         DELETE OBJECT levelObj(i, j)
      NEXT j
   NEXT i
   UNDIM level(levW, levH)
   UNDIM levelObj(levW, levH)
   UNDIM levelMoves(numMoves)
RETURN
 
LoadNextLevel:
   READ MapName$
   READ levW
   READ levH
   DIM level(levW, levH)
   DIM levelObj(levW, levH)
   INC CurLevel
   FOR i = 1 TO levH
      FOR j = 1 to levW
         READ level(i, j)
         IF level(i, j) = 2
            blueI = i
            blueJ = j
         ENDIF
         levelObj(i, j) = FreeObject()
         IF level(i, j) > 6 AND level(i, j) < 11
            CLONE OBJECT levelObj(i, j), 7
         ELSE
            IF level(i, j) = 11
               CLONE OBJECT levelObj(i, j), 5
            ELSE
               CLONE OBJECT levelObj(i, j), level(i, j)
            ENDIF
         ENDIF
         POSITION OBJECT levelObj(i, j), j*5.4, -2.5, i*5.4
      NEXT j
   NEXT i
 
   READ numMoves
   TPages = (numMoves/27) + 1
   DIM levelMoves(numMoves)
   DIM qMoves(numMoves+1)
   DIM qMoveKeys(numMoves+1)
   numQMoves = 0
   FOR i = 1 to numMoves
      READ levelMoves(i)
   NEXT i
RETURN
 
GetNextSquare:
   YROTATE OBJECT 100, ConvAng#
   remstart Space# = 5.4
   MOVE OBJECT 100, 5.42
   oZ# = OBJECT POSITION Z(100)
   oX# = OBJECT POSITION X(100)
   pNextI = oZ# / Space#
   TEXT 5, 250, STR$(OBJECT POSITION Z(100))
   TEXT 5, 261, STR$(OBJECT POSITION X(100))
   TEXT 5, 272, STR$(OBJECT ANGLE Y(100))
   pNextJ = oX# / Space#
   MOVE OBJECT 100, -5.42
   remend
   pNextI = pI
   pNextJ = pJ
   IF ConvAng# = 0 THEN pNextI = pI + 1
   IF ConvAng# = 90 THEN pNextJ = pJ + 1
   IF ConvAng# = 180 THEN pNextI = pI - 1
   IF ConvAng# = 270 THEN pNextJ = pJ - 1
   YROTATE OBJECT 100, PAng#
   IF pNextI > levW OR pNextJ > levH OR pNextI < 1 OR pNextJ < 1
      nextSquare = 0
      RETURN
   ENDIF
   nextSquare = level(pNextI, pNextJ)
RETURN
 
GetCurSquare:
   pI = (OBJECT POSITION Z(100)) / 5.3
   pJ = (OBJECT POSITION X(100)) / 5.3
   IF pI > levW OR pJ > levH OR pI < 1 OR pJ < 1
      curSquare = 0
      RETURN
   ENDIF
   curSquare = level(pI, pJ)
RETURN
 
GetPrevSquare:
   YROTATE OBJECT 100, ConvAng#
   REMSTART
   MOVE OBJECT 100, -5.41
   pPrevI = OBJECT POSITION Z(100) / 5.40000
   pPrevJ = OBJECT POSITION X(100) / 5.40000
   MOVE OBJECT 100, 5.41
   REMEND
   pPrevI = pI
   pPrevJ = pJ
   IF ConvAng# = 0 THEN pPrevI = pI - 1
   IF ConvAng# = 90 THEN pPrevJ = pJ - 1
   IF ConvAng# = 180 THEN pPrevI = pI + 1
   IF ConvAng# = 270 THEN pPrevJ = pJ + 1
   YROTATE OBJECT 100, PAng#
   IF pPrevI > levW OR pPrevJ > levH OR pPrevI < 1 OR pPrevJ < 1
      prevSquare = 0
      RETURN
   ENDIF
   prevSquare = level(pPrevI, pPrevJ)
RETURN
 
GameOver:
   SpaceDown = 1
   Running = 0
   Action = 0
   Stopped = 0
   Movement# = 0.0
   FOR Key = 1 TO numQMoves
      IF Key <= numQMoves AND qMoves(Key) <> 0
         levelMoves(qMoveKeys(Key)) = qMoves(Key)
         qMoves(Key) = 0
         qMoveKeys(Key) = 0
      ENDIF
   NEXT Key
   numQMoves = 0
   DO
      CENTER TEXT scrW/2, 25, "YOU FAILED. PRESS SPACE TO TRY AGAIN OR ESC TO QUIT."
 
      REMSTART
      pizzle# = (OBJECT POSITION Z(100)) / 5.3
      TEXT 5, 200, STR$(nextSquare)+":"+STR$(curSquare)+":"+STR$(prevSquare)
      TEXT 5, 211, STR$(pNextI)+","+STR$(pNextJ)
      TEXT 5, 222, STR$(pI)+","+STR$(pJ)
      TEXT 5, 233, STR$(pPrevI)+","+STR$(pPrevJ)
      TEXT 5, 244, STR$(pizzle#)
      TEXT 5, 255, STR$(OBJECT POSITION Z(100))
      TEXT 5, 266, STR$(Action)
      TEXT 5, 277, STR$(Movement#)
      TEXT 5, 288, STR$(curMove)
      TEXT 5, 299, STR$(numQMoves)
      REMEND
      IF KEYSTATE(57) = 1 AND SpaceDown = 0
         SpaceDown = 1 : GOSUB RESTART
      ENDIF
      IF KEYSTATE(57) = 0 AND SpaceDown = 1 THEN SpaceDown = 0
      SYNC
   LOOP
 
RETURN
 
FUNCTION FreeObject()
   FOR i = 1 TO 65535
      IF OBJECT EXIST(i) = 0 THEN EXITFUNCTION i
   NEXT i
ENDFUNCTION -1
 
FUNCTION KeyToInt(K as String)
   iKey = ASC(K)
   IF iKey > 96 AND iKey < 123
      EXITFUNCTION iKey - 96
   ENDIF
 
   IF iKey > 64 AND iKey < 97
      EXITFUNCTION iKey + 36
   ENDIF
ENDFUNCTION 0
 
Function Make_Robot(ObjectID)
If Object Exist (ObjectID) Then Delete Object ObjectID
Make Object Cube ObjectID,5
If Object Exist(2) Then Delete Object 2
If Mesh Exist(2) Then Delete Mesh 2
Make Object Sphere 2,5
Make Mesh From Object 2,2
Add Limb ObjectID,1,2
Offset Limb ObjectID,1,0,4,0
Delete Mesh 2
Delete Object 2
Make Object Cylinder 2,4
Scale Object 2,30,100,30
Offset Limb 2,0,0,2,0
Roll Object Right 2,100
Fix Object Pivot 2
Make Mesh From Object 2,2
Add Limb ObjectID,2,2
Add Limb ObjectID,3,2
Offset Limb ObjectID,2,0,1,-3
Offset Limb ObjectID,3,0,1,3
Color Limb ObjectID,2,RGB(128,128,128)
Color Limb ObjectID,3,RGB(128,128,128)
Delete Mesh 2
Delete Object 2
Make Object Cylinder 2,10
Scale Object 2,100,20,20
Pitch Object Down 2,90
Fix Object Pivot 2
Make Mesh From Object 2,2
Add Limb ObjectID,4,2
Add Limb ObjectID,5,2
Offset Limb ObjectID,4,0,-3,-3
Offset Limb ObjectID,5,0,-3,3
Delete Object 2
Delete Mesh 2
Make Object Sphere 2,10
Scale Object 2,100,20,1
Make Mesh from Object 2,2
Add Limb ObjectID,6,2
Add Limb ObjectID,7,2
Offset Limb ObjectID,6,0,-3,-3.9
Offset Limb ObjectID,7,0,-3,3.9
Delete Object 2
Delete Mesh 2
Set Object Cull ObjectID,0
Turn Object Left ObjectID,90
Fix Object Pivot ObjectID
Color Object ObjectID, RGB(255, 255, 0) `Robot.Color
If Bitmap Exist(1) Then Delete Bitmap 1
Create Bitmap 1,100,20
Set Current Bitmap 1
Ink RGB(210,210,210),0
Box 0,0,99,19
Ink Rgb(40,40,40),0
For i = 0 to 90 step 10
   Box i,0,i+1,19
Next i
Get Image 1,0,0,99,19
Delete Bitmap 1
Texture Limb ObjectID,4,1
Texture Limb ObjectID,5,1
Set Object Collision Off ObjectID
Set Object Collision to Boxes ObjectID
EndFunction R
 
REMSTART
DATA "R2D2! YOU'RE MY ONLY HOPE"
Data 5,5
Data 2, 1, 1,10, 1
Data 6, 8, 8,10, 1
Data 1, 1, 3,10, 1
Data 1, 9, 7, 7, 7
Data 1, 9, 1, 1, 1
Data 10
Data 3,3,3,3,1,1,4,4,4,4
 
DATA "Easy looker"
DATA 5, 5
DATA 2, 1, 5, 1, 1
DATA 1, 6, 1, 6, 1
DATA 1, 6, 3, 6, 1
DATA 1, 1, 6, 1, 1
DATA 1, 1, 1, 1, 1
DATA 6
DATA 1, 1, 4, 5, 6, 2
 
 
DATA "Skills"
DATA 5, 5
DATA 1, 1, 1, 1, 1
DATA 1, 6, 1, 6, 5
 
DATA 1, 6, 2, 6, 11
DATA 1, 6, 6, 6, 5
DATA 1, 1, 1, 1, 3
DATA 9
DATA 2, 4, 2, 4, 2, 6, 1, 6, 1
REMEND
 
`  Objects:
`  1  = Grey square
`  2  = Blue square (start)
`  3  = Green square (end)
`  4  = Black square
`  5  = Red square (Rotates RIGHT)
`  6  = Yellow square (WALL)
`  7  = Purple (Rotates to the upper left) DOWN in data statements
`  8  = Purple (Rotates to the lower right) UP in data statements
`  9  = Purple (rotates lower left) LEFT in data statements
`  10 = Purple (Rotates upper right) RIGHT in data statements
`  11 = Red Square (Rotates LEFT)
 
`  Moves:
`  1  = "Forward 1"
`  2  = "Forward 2"
`  3  = "Forward 3"
`  4  = "Rotate Left"
`  5  = "Rotate Right"
`  6  = "Rotate 180"
`  7  = "Backward 1"
 
Data "The MAMMOTH"   `Name of map
Data 15, 15            `DIMENSIONS OF LEVEL: Can be any amount. The first is Width and the Second... HEIGHT.
 
Data 2, 1, 7, 4, 5, 1,11, 4, 3, 3, 6, 5, 1, 1, 10  `The next 15 (HEIGHT) lines contain the objects of the level
Data 4, 4, 7, 1, 8, 6, 7, 6, 3, 3, 4, 8, 4, 1, 10  `The levels are reversed vertically when it renders. I am lazy therefore.
Data 4, 4, 4, 4, 7, 6, 7, 4, 3, 3, 4, 9, 6, 1, 10
Data 1, 1, 1, 1, 4, 6, 7, 6, 3, 3, 4, 8, 4,10, 10
Data 1, 1, 1, 1, 1, 6, 7,11, 6, 4, 4, 8, 6, 1, 9
Data 1, 5, 5, 1, 1, 6, 4, 1, 6, 1, 5, 5, 4, 1, 10
Data 1, 1, 6, 1, 1, 1, 9, 9, 6, 1,11, 1, 6, 1, 10
Data 6, 7, 6, 6, 6, 4, 4, 4, 4, 1, 4, 6, 4, 10,10
Data 4, 7, 1, 1, 6, 5, 1, 1, 4, 7, 9, 1, 6, 8, 10
Data 4, 7, 4, 1, 6, 1, 6, 1, 6, 7, 4, 1, 4, 5, 10
Data 4, 7, 1, 1, 6, 1, 6, 1, 6, 4, 1, 1, 6, 1, 10
Data 4,10, 4,11, 1, 7, 6, 9, 4, 4, 1, 4, 4, 9, 10
Data 4, 4, 4, 4, 6, 1, 6, 1, 6, 4, 1, 8, 6,10, 10
Data 4, 4, 4, 4, 6, 4, 1, 5, 1, 5, 6, 8, 4,10, 10
Data 4, 4, 4, 4, 6, 6, 6, 6, 6, 1, 1, 8, 6, 3, 9
 
DATA 60               `TOTAL Number of possible moves
DATA 2,5,1,2,5,2,3,5,4,2,3,1,5,2,2,4,2,4,1,2,4,2,1,4,2,5      `Then the list of moves.
DATA 7,4,1,5,2,5,4,2,7,4,2,1,7,5,3,1,2,2,3,2,3,4,3,1,4,2,7,5,2,2,2,7,3,1
 
DATA "The MAMMOTH II"
DATA 2, 2
 
DATA 2, 1
DATA 1, 3
 
DATA 10
DATA 1, 6, 1, 6, 7, 6, 7, 6, 7, 1