' vecalabeth CALL SetFrameRate(70) call IntensitySprite(60) textSize = {40,5} call TextSizeSprite(textSize) instructions = {{-50,90,"VECALABETH"},_ {-120,70,"ORIGINAL BY RICHARD GARRIOTT - 1979"},_ {-100,50,"PORTED BY PIX - 2016"},_ {-80,30,"PRESS BTN 1 TO START"}} call TextListSprite(instructions) ' Wait for button 1 controls = WaitForFrame(JoystickNone,Controller1,JoystickNone) while controls[1,3] = 0 controls = WaitForFrame(JoystickNone,Controller1,JoystickNone) endwhile call ClearScreen() ' Create a one level map for testing. 1-4 = wall type N,E,S,W. 5 = contents of room level = {_ {1,1,0,1,0},{1,1,0,1,0},{1,1,0,1,0},{1,2,0,2,0},{1,1,0,1,0},{1,1,0,1,0},{1,1,0,1,0},{1,1,0,1,0},{1,1,0,1,0},_ {0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,2,0,2,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{1,1,0,1,0},{0,1,0,1,0},_ {0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,2,0,2,9},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{1,1,0,1,0},{0,1,0,1,0},_ {0,0,0,1,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,1,0,0,0},_ {0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{1,1,0,1,0},{0,1,0,1,0},_ {0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,10},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{1,1,0,1,0},{0,1,0,1,0},_ {0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{1,1,0,1,0},{0,1,0,1,0},_ {0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{0,1,0,1,0},{1,1,0,1,0},{0,1,0,1,0},_ {0,1,1,1,0},{0,1,1,0,0},{0,1,1,1,0},{0,1,1,1,0},{0,1,1,1,0},{0,1,1,1,0},{0,1,1,1,0},{1,1,1,1,0},{0,1,1,1,0} _ } scaler = {84,55,37,26,15,12,7,5} ' Stores player details. 1 + 2 = X + Y coords. 3 = Direction Facing,4 = food,5 = hp,6 = gold playerDetails = {4,4,1,123.4,99,1111} framecount = 0 call showPosition() while controls[1,6] = 0 controls = WaitForFrame(JoystickDigital,Controller1,JoystickX + JoystickY) framecount = framecount + 1 'only allow one move per second if framecount >= GetFrameRate()/4 then if controls[1,1] < 0 then 'turn left playerDetails[3] = playerDetails[3]-1 framecount = 0 if playerDetails[3] < 1 then playerDetails[3]=4 endif elseif controls[1,1] > 0 then 'turn right playerDetails[3] = playerDetails[3]+1 framecount = 0 if playerDetails[3] > 4 then playerDetails[3]=1 endif endif if controls[1,2] < 0 then call Move("B") elseif controls[1,2] > 0 call Move("F") endif if framecount = 0 then call showPosition() endif endif endwhile sub ShowPosition() call clearScreen() drawnMonster = false left = playerDetails[3] - 1 right = playerDetails[3] + 1 back = playerDetails[3] + 2 scale = 250 if left = 0 then left = 4 endif if left = 5 then left = 1 endif if back = 5 then back = 1 endif if back = 6 then back = 2 endif if right = 0 then right = 4 endif if right = 5 then right = 1 endif x=playerDetails[1] y=playerDetails[2] runcount = 1 repeat Dim WallLines if runcount <> 1 then if playerDetails[3] = 1 then y = y -1 elseif playerDetails[3] = 2 then x = x + 1 elseif playerDetails[3] = 3 then y = y + 1 elseif playerDetails[3] = 4 then x = x -1 endif endif if level[x + ((y-1) *9),left] = 1 or level[x + ((y-1) *9),left] = 2 then WallLines = {{MoveTo,-60,60},{DrawTo,-40,40},{MoveTo,-40,-40},{DrawTo,-60,-60}} else WallLines = {{MoveTo,-60,40},{DrawTo,-40,40},{DrawTo,-40,-40},{DrawTo,-60,-40}} if level[x + ((y-1) *9),back] = 1 or level[x + ((y-1) *9),back] = 2 WallLines = AppendArrays(WallLines,{{MoveTo,-60,-40},{DrawTo,-60,40}}) else WallLines = AppendArrays(WallLines,{{MoveTo,-60,-60},{DrawTo,-60,60}}) endif endif if level[x + ((y-1) *9),left] = 2 then WallLines = AppendArrays(WallLines,{{MoveTo,-55,-55},{DrawTo,-55,35},{DrawTo,-45,30},{DrawTo,-45,-45}}) endif if level[x + ((y-1) *9),playerDetails[3]] = 1 or level[x + ((y-1) *9),playerDetails[3]] = 2 then WallLines = AppendArrays(WallLines,{{MoveTo,-40,40},{DrawTo,-40,-40},{DrawTo,40,-40},{DrawTo,40,40},{DrawTo,-40,40}}) endif if level[x + ((y-1) *9),playerDetails[3]] = 2 then WallLines = AppendArrays(WallLines,{{MoveTo,-20,-40},{DrawTo,-20,20},{DrawTo,20,20},{DrawTo,20,-40}}) endif if level[x + ((y-1) *9),right] = 1 or level[x + ((y-1) *9),right] = 2 then WallLines = AppendArrays(WallLines,{{MoveTo,60,60},{DrawTo,40,40},{MoveTo,40,-40},{DrawTo,60,-60}}) else WallLines = AppendArrays(WallLines,{{MoveTo,60,40},{DrawTo,40,40},{DrawTo,40,-40},{DrawTo,60,-40}}) if level[x + ((y-1) *9),back] = 1 or level[x + ((y-1) *9),back] = 2 WallLines = AppendArrays(WallLines,{{MoveTo,60,-40},{DrawTo,60,40}}) else WallLines = AppendArrays(WallLines,{{MoveTo,60,-60},{DrawTo,60,60}}) endif endif if level[x + ((y-1) *9),right] = 2 then WallLines = AppendArrays(WallLines,{{MoveTo,55,-55},{DrawTo,55,35},{DrawTo,45,30},{DrawTo,45,-45}}) endif call returnToOriginSprite() call MoveSprite(1,1) call MoveSprite(-1,-1) call ScaleSprite(scale) sprite = LinesSprite(WallLines) if level[x + ((y-1) *9),5] = 1 and drawnMonster = false call DrawBalron(scale) drawnMonster = true elseif level[x + ((y-1) *9),5] = 2 and drawnMonster = false call DrawMinotaur(scale) drawnMonster = true elseif level[x + ((y-1) *9),5] = 3 and drawnMonster = false call DrawGremlin(scale) drawnMonster = true elseif level[x + ((y-1) *9),5] = 4 call DrawChest(scale) elseif level[x + ((y-1) *9),5] = 5 and drawnMonster = false call DrawCarrionCreeper(scale) elseif level[x + ((y-1) *9),5] = 6 and drawnMonster = false call DrawSnake(scale) elseif level[x + ((y-1) *9),5] = 7 and drawnMonster = false call DrawOrc(scale) elseif level[x + ((y-1) *9),5] = 8 and drawnMonster = false call DrawRat(scale) elseif level[x + ((y-1) *9),5] = 9 and drawnMonster = false call DrawThief(scale) elseif level[x + ((y-1) *9),5] = 10 and drawnMonster = false call DrawSkeleton(scale) endif scale = scale - scaler[runcount] runcount = runcount + 1 until level[x + ((y-1) *9 ),playerDetails[3]] = 1 or level[x + ((y-1) *9 ),playerDetails[3]] = 2 call returnToOriginSprite() position = {{-120,-100,"FOOD=" + playerDetails[4]},_ {-120,-110,"HP=" + playerDetails[5]},_ {-120,-120,"GOLD=" + playerDetails[6]}} call TextListSprite(position) endsub sub drawLineSprite(Lines,scale) call returnToOriginSprite() call MoveSprite(1,1) call MoveSprite(-1,-1) call ScaleSprite(scale) sprite = LinesSprite(Lines) endsub sub drawDotsSprite(modeDots,scale) call returnToOriginSprite() call MoveSprite(1,1) call MoveSprite(-1,-1) call ScaleSprite(scale) sprite = DotsSprite(modeDots) endsub sub drawLines(array, scale) x = -50 scale = scale * 0.9 Dim line for i = 1 to UBound(array,1) if array[i,1] = "M" then if i > 1 then call drawLineSprite(line, scale) endif line = {{MoveTo,array[i,2],array[i,3]+x}} else line = AppendArrays(line,{{DrawTo,array[i,2],array[i,3]+x}}) endif next i call drawLineSprite(line, scale) endsub sub drawSkeleton(scale) skeleton = {{"M",23,0},{"D",15,0},{"D",15,15},{"D",8,30},{"D",-8,30},{"D",-15,15},{"D",-15,0},{"D",-23,0},_ {"M",0,26},{"D",0,65},{"M",2,38},{"D",-2,38},{"M",3,45},{"D",-3,45},{"M",5,53},{"D",-5,53},_ {"M",23,56},{"D",30,53},{"D",23,45},{"D",23,53},{"D",8,38},_ {"M",15,45},{"D",8,60},{"D",-8,60},{"D",-15,45},{"D",-15,42},{"D",-15,57},{"M",-12,45},{"D",-20,45},_ {"M",0,75},{"D",5,80},{"D",8,75},{"D",5,65},{"D",-5,65},{"D",-5,68},{"D",5,68},{"D",5,65},_ {"M",-5,65},{"D",-8,75},{"D",-5,80},{"D",5,80}} call drawLines(skeleton, scale) x = -50 scale = scale * 0.9 Dots = {{5,72+x},{-5,72+x}} call drawDotsSprite(Dots,scale) endsub sub drawThief(scale) thief = {{"M",0,56},{"D",0,8},{"D",-10,0},{"D",-30,0},{"D",-30,45},{"D",-10,64},{"D",0,56},_ {"M",10,64},{"D",30,45},{"D",30,0},{"D",20,0},{"D",0,8},_ {"M",10,64},{"D",10,75},{"D",0,83},{"D",-10,75},{"D",0,79},{"D",10,75},{"D",0,60},{"D",-10,75},{"D",-10,64}} call drawLines (thief, scale) endsub sub drawRat(scale) rat = {{"M",-5,30},{"D",0,25},{"D",5,30},{"D",15,5},{"D",10,0},{"D",-10,0},{"D",-15,5},_ {"M",-20,5},{"D",-10,0},{"D",-15,5},{"D",-5,30},{"D",-10,40},{"D",-3,35},_ {"D",3,35},{"D",10,40},{"D",5,30},_ {"M",5,33},{"D",3,30},{"M",-5,33},{"D",-3,30},{"M",5,20},{"D",5,15},_ {"M",-5,20},{"D",-5,15},{"M",7,20},{"D",7,15},{"M",-7,20},{"D",-7,15}} call drawLines (rat, scale) endsub sub drawOrc(scale) orc = {{"M",0,0},{"D",15,0},{"D",8,8},{"D",8,15},{"D",15,23},{"D",15,15},{"D",23,23},_ {"M",23,23},{"D",23,45},{"D",15,53},{"D",8,53},{"D",15,68},{"D",8,75},{"D",0,75},_ {"M",0,0},{"D",-15,0},{"D",-8,8},{"D",-8,15},{"D",-15,23},{"D",-15,15},{"D",-23,23},_ {"M",-23,23},{"D",-23,45},{"D",-15,53},{"D",-8,53},{"D",-15,68},{"D",-8,75},{"D",0,75},_ {"M",15,68},{"D",-15,68},{"M",8,53},{"D",-8,53},{"M",23,15},{"D",-8,45},_ {"M",8,68},{"D",-0,60},{"D",-8,68},{"D",-8,60},{"D",8,60},{"D",8,68},_ {"M",0,38},{"D",8,38},{"D",-8,53},{"D",-8,45},{"D",-15,45},{"D",0,30},{"D",0,38}} call drawLines (orc,scale) endsub sub drawSnake(scale) snake = {{"M",10,15},{"D",10,30},{"D",15,20},{"D",15,15},{"D",15,0},{"D",-15,0},{"D",-15,15},{"D",15,15},_ {"M",15,10},{"D",-15,10},{"M",15,5},{"D",-15,5},_ {"M",0,15},{"D",5,20},{"D",5,35},{"D",-5,35},{"D",-5,20},{"D",-10,15},_ {"M",5,20},{"D",-5,20},{"M",5,25},{"D",-5,25},{"M",5,30},{"D",-5,30},_ {"M",10,35},{"D",10,40},{"D",5,45},{"D",-5,45},{"D",-10,40},{"D",-10,35},_ {"M",10,40},{"D",0,45},{"D",-10,40},_ {"M",5,40},{"D",-5,40},{"D",-15,30},{"D",0,40},{"D",15,30},{"D",4.5,40}} call drawLines (snake,scale) endsub sub drawCarrionCreeper(scale) carrionCreeper = {{"M",20,93},{"D",20,88},{"D",10,83},{"D",-10,83},{"D",-20,88},{"D",-20,93},_ {"M",20,88},{"D",30,83},{"D",30,78},{"M",-20,88},{"D",-30,83},{"D",-40,83},_ {"M",15,86},{"D",20,83},{"D",20,78},{"D",30,73},{"D",30,68},{"D",20,63},_ {"M",10,83},{"D",10,58},{"D",0,50},{"M",-10,83},{"D",-10,78},{"D",-20,73},{"D",-20,40},_ {"M",-15,85},{"D",-20,78},{"D",-30,76},{"D",-30,60},_ {"M",0,83},{"D",0,73},{"D",-10,68},{"D",-10,63},{"D",0,58}} call drawLines (carrionCreeper,scale) endsub sub drawChest(scale) chest = {{"M",13,0},{"D",13,10},{"D",-7,10},{"D",-7,0},{"D",13,0},_ {"M",13,10},{"D",8,15},{"D",-12,15},{"D",-12,5},{"D",-7,0},_ {"M",-7,10},{"D",-12,15}} call drawLines (chest,scale) endsub sub drawGremlin(scale) gremlin = {{"M",-5.5,10},{"D",4.5,10},{"D",0,15},{"D",-10,20},{"D",-5.5,15},{"D",-5.5,10},_ {"M",-5.5,10},{"D",-7.5,6},{"D",-5.5,3},{"D",4.5,3},{"D",6.5,6},{"D",4.5,10},_ {"M",-2.5,3},{"D",-5.5,0},{"D",-8,0},{"M",1.5,3},{"D",4.5,0},{"D",8,0},{"M",-3.5,5},{"D",2.5,5}} call drawLines (gremlin,scale) x = -50 scale = scale * 0.9 Dots = {{-3.5,8+x},{2.5,8+x}} call drawDotsSprite(Dots,scale) endsub sub drawBalron(scale) balron = {{"M",-6,60},{"D",-30,90},{"D",-60,30},{"D",-60,10},{"D",-30,40},{"D",-15,40},_ {"M",6,60},{"D",30,90},{"D",60,30},{"D",60,10},{"D",30,40},{"D",15,40},_ {"M",0,25},{"D",-6,25},{"D",-10,20},{"D",-12,10},{"D",-10,6},_ {"D",-10,0},{"D",-14,0},{"D",-15,5},{"D",-16,0},{"D",-20,0},_ {"M",-20,0},{"D",-20,6},{"D",-18,10},{"D",-18,20},{"D",-15,30},{"D",-15,45},{"D",-40,60},{"D",-40,70},_ {"M",-40,70},{"D",-10,55},{"D",-6,60},{"D",-10,74},{"D",-6,80},_ {"D",-4.5,80},{"D",-3.5,82},{"D",-2.5,80},{"D",0,80},_ {"M",0,25},{"D",6,25},{"D",10,20},{"D",12,10},{"D",10,6},_ {"D",10,0},{"D",14,0},{"D",15,5},{"D",16,0},{"D",20,0},_ {"M",20,0},{"D",20,6},{"D",18,10},{"D",18,20},{"D",15,30},{"D",15,45},{"D",40,60},{"D",40, 70},_ {"M",40,70},{"D",10,55},{"D",6,60},{"D",10,74},{"D",6,80},_ {"D",4.5,80},{"D",3.5,82},{"D",2.5,80},{"D",0,80},_ {"M",6,25},{"D",0,6},{"D",-10,0},{"D",-4.5,8},{"D",-6,25},_ {"M",40,64},{"D",40,90},{"D",52,80},{"D",52,40},_ {"M",- 40,86},{"D",-38,92},{"D",-42,92},{"D",-40,86},{"D",-40,50},_ {"M",-4.5,70},{"D",-6,74},{"M",3.5,70},{"D",6,74},{"M",0,64},{"D",0,60}} call drawLines (balron,scale) endsub sub drawMinotaur(scale) balron = {{"M",14,46},{"D",12,37},{"D",20,32},{"D",30,32},_ {"D",22,24},{"D",40,17},{"D",40,7},{"D",38,5},{"D",40,3},{"D",40,0},_ {"M",40,0},{"D",36,0},{"D",34,2},{"D",32,0},{"D",28,0},_ {"D",28,3},{"D",30,5},{"D",28,7},{"D",28,15},{"D",0,27},_ {"M",-14,46},{"D",-12,37},{"D",-20,32},{"D",-30,32},_ {"D",-22,24},{"D",-40,17},{"D",-40,7},{"D",-38,5},{"D",-40,3},{"D",-40,0},_ {"M",-40,0},{"D",-36,0},{"D",-34,2},{"D",-32,0},{"D",-28,0},{"D",-28,3},_ {"D",-30,5},{"D",-28,7},{"D",-28,15},{"D",0,27},_ {"M",-6,48},{"D",-38,41},{"D",-40,42},{"D",-18,56},{"D",-12,56},_ {"D",-10,57},{"D",-8,56},{"D",8,56},{"D",10,58},{"D",-14,58},{"D",-16,59},_ {"M",-16,59},{"D",-8,63},{"D",-6,63},{"D",-2.5,70},{"D",-2.5,63},{"D",2.5,63},_ {"D",2.5,70},{"D",6,63},{"D",8,63},{"D",16,59},{"D",14,58},_ {"M",14,58},{"D",10,57},{"D",12,56},{"D",18,56},{"D",36,47},{"D",36,39},_ {"D",28,41},{"D",28,46},{"D",20,50},{"D",18,50},{"D",14,46},_ {"M",28,41},{"D",-30,55},{"M",-28,58},{"D",-22,56},{"D",-22,53},_ {"D",-28,52},{"D",-34,54},{"M",-20,50},{"D",-26,47},_ {"M",-10,58},{"D",-10,61},{"D",-4,58},{"M",10,58},{"D",10,61},_ {"D",4,58},{"M",-40,9},{"D",-50,12},{"D",-40,7},_ {"M",8,25},{"D",-6,7},{"D",-28,7},{"D",-28,9},{"D",-20,9},{"D",-6,25}} call drawLines (minotaur,scale) endsub sub Move(direction) if ((playerDetails[3] = 3 and direction = "F") or (playerDetails[3] = 1 and direction = "B")) and MoveAllowed(3) then playerDetails[2] = playerDetails[2] + 1 elseif ((playerDetails[3] = 1 and direction = "F") or (playerDetails[3] = 3 and direction = "B")) and MoveAllowed(1) then playerDetails[2] = playerDetails[2] - 1 elseif ((playerDetails[3] = 2 and direction = "F") or (playerDetails[3] = 4 and direction = "B")) and MoveAllowed(2) then playerDetails[1] = playerDetails[1] + 1 elseif ((playerDetails[3] = 4 and direction = "F") or (playerDetails[3] = 2 and direction = "B")) and MoveAllowed(4) then playerDetails[1] = playerDetails[1] - 1 endif framecount = 0 endsub function MoveAllowed(direction) print level[playerDetails[1] + ((playerDetails[2] * 9)-9),direction] if level[playerDetails[1] + ((playerDetails[2] * 9)-9),direction] <> 1 then return true else return false endif endfunction