Author Topic: subscript out of range and suspicious non-appearance  (Read 4086 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline Jaze

  • Newbie
  • Posts: 86
    • View Profile
subscript out of range and suspicious non-appearance
« on: December 07, 2020, 08:44:34 pm »
I'm trying to write an old style early-age computer game. The battle sequence I'm trying to create won't often won't show the ships until it is moved. Sometimes I get a subscript out of range. I'm including the code. Most of it is totally repetitive, trying to draw one of the ships. Please help.

WIDTH 80, 50

CONST shotDelay = 0.03
CONST fireBeep = "L64O3CEGAA"
CONST shipHitBeep = "L64O1EEEEEL16CC"

DIM SHARED battleScreen(1 TO 80, 1 TO 45, 1 TO 2)

FOR fillY = 1 TO 45
    FOR fillX = 1 TO 80
        battleScreen(fillX, fillY, 1) = 32
        battleScreen(fillX, fillY, 2) = 0
    NEXT fillX
NEXT fillY

RANDOMIZE TIMER
COLOR 0, 0
CLS
LOCATE 1, 1

CALL Battle

SUB PrintBattleScreen ()
    CLS: LOCATE 1, 1
    FOR printY = 1 TO 45
        FOR printX = 1 TO 80
            IF printX <> 80 THEN
                COLOR battleScreen(printX, printY, 2), 0
                PRINT CHR$(battleScreen(printX, printY, 1));
            ELSE
                COLOR battleScreen(printX, printY, 2), 0
                PRINT CHR$(battleScreen(printX, printY, 1))
            END IF
        NEXT printX
    NEXT printY
END SUB

SUB RelocateSarain

END SUB

SUB Battle
    'randNum% = INT(RND * (max% - min% + 1)) + min%
    xPos = INT(RND * 71) + 5
    yPos = INT(RND * 41) + 5
    intFacing = INT(RND * 4) + 1: IF intFacing = 1 THEN facing$ = "N": IF intFacing = 2 THEN facing$ = "S": IF intFacing = 3 THEN facing$ = "W": IF intFacing = 4 THEN facing$ = "E"
    CALL DrawEspializer(xPos, yPos, facing$)
    xPos = INT(RND * 71) + 5
    yPos = INT(RND * 41) + 5
    intFacing = INT(RND * 4) + 1: IF intFacing = 1 THEN facing$ = "N": IF intFacing = 2 THEN facing$ = "S": IF intFacing = 3 THEN facing$ = "W": IF intFacing = 4 THEN facing$ = "E"
    CALL DrawSarian(xPos, yPos, facing$)
    CALL PrintBattleScreen

    DO
        whichMove$ = INKEY$

        SELECT CASE whichMove$
            CASE CHR$(0) + "H" ' up
                IF yPos > 5 THEN
                    CALL EraseEspializer(xPos, yPos, facing$)
                    yPos = yPos - 1: facing$ = "N"
                    CALL DrawEspializer(xPos, yPos, facing$)
                    CALL PrintBattleScreen
                END IF
            CASE CHR$(0) + "K" ' left
                IF xPos > 5 THEN
                    CALL EraseEspializer(xPos, yPos, facing$)
                    xPos = xPos - 1: facing$ = "W"
                    CALL DrawEspializer(xPos, yPos, facing$)
                    CALL PrintBattleScreen
                END IF
            CASE CHR$(0) + "P" ' down
                IF yPos < 40 THEN
                    CALL EraseEspializer(xPos, yPos, facing$)
                    yPos = yPos + 1: facing$ = "S"
                    CALL DrawEspializer(xPos, yPos, facing$)
                    CALL PrintBattleScreen
                END IF
            CASE CHR$(0) + "M" ' right
                IF xPos < 75 THEN
                    CALL EraseEspializer(xPos, yPos, facing$)
                    xPos = xPos + 1: facing$ = "E"
                    CALL DrawEspializer(xPos, yPos, facing$)
                    CALL PrintBattleScreen
                END IF
            CASE CHR$(27)
                END
        END SELECT
        '        _DELAY (0.05)

        '        FOR moveIt = 40 TO 50
        '        CALL DrawEspializer(moveIt, 22, "E")
        '        CALL PrintBattleScreen
        '        _DELAY (0.05)
        '        CALL EraseEspializer(moveIt, 22, "E")
        '        CALL PrintBattleScreen
        '        NEXT moveIt
    LOOP UNTIL whichMove$ = CHR$(27)
END SUB

SUB DrawSarian (centerX, centerY, orientation$)
    SELECT CASE orientation$
        CASE "N"
            battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 10
            battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 10
            battleScreen(centerX + 0, centerY - 1, 1) = 219: battleScreen(centerX + 0, centerY - 1, 2) = 10
        CASE "S"
            battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 10
            battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 10
            battleScreen(centerX + 0, centerY + 1, 1) = 219: battleScreen(centerX + 0, centerY + 1, 2) = 10
        CASE "W"
            battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 10
            battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 10
            battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 10
        CASE "E"
            battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 10
            battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 10
            battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 10
    END SELECT
END SUB

SUB EraseSerian (centerx, centery, orientation$)
    SELECT CASE orientation$
        CASE "N"
            battleScreen(centerx - 1, centery + 0, 1) = 219: battleScreen(centerx - 1, centery + 0, 2) = 0
            battleScreen(centerx + 1, centery + 0, 1) = 219: battleScreen(centerx + 1, centery + 0, 2) = 0
            battleScreen(centerx + 0, centery - 1, 1) = 219: battleScreen(centerx + 0, centery - 1, 2) = 0
        CASE "S"
            battleScreen(centerx - 1, centery + 0, 1) = 219: battleScreen(centerx - 1, centery + 0, 2) = 0
            battleScreen(centerx + 1, centery + 0, 1) = 219: battleScreen(centerx + 1, centery + 0, 2) = 0
            battleScreen(centerx + 0, centery + 1, 1) = 219: battleScreen(centerx + 0, centery + 1, 2) = 0
        CASE "W"
            battleScreen(centerx - 1, centery + 0, 1) = 219: battleScreen(centerx - 1, centery + 0, 2) = 0
            battleScreen(centerx + 1, centery - 1, 1) = 219: battleScreen(centerx + 1, centery - 1, 2) = 0
            battleScreen(centerx + 1, centery + 1, 1) = 219: battleScreen(centerx + 1, centery + 1, 2) = 0
        CASE "E"
            battleScreen(centerx + 1, centery + 0, 1) = 219: battleScreen(centerx + 1, centery + 0, 2) = 0
            battleScreen(centerx - 1, centery - 1, 1) = 219: battleScreen(centerx - 1, centery - 1, 2) = 0
            battleScreen(centerx - 1, centery + 1, 1) = 219: battleScreen(centerx - 1, centery + 1, 2) = 0
    END SELECT

END SUB

SUB DrawEspializer (centerX, centerY, orientation$)
    SELECT CASE orientation$
        CASE "E"
            battleScreen(centerX - 4, centerY - 3, 1) = 219: battleScreen(centerX - 4, centerY - 3, 2) = 9
            battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 9
            battleScreen(centerX - 2, centerY - 3, 1) = 219: battleScreen(centerX - 2, centerY - 3, 2) = 9
            battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 9
            battleScreen(centerX - 0, centerY - 3, 1) = 219: battleScreen(centerX - 0, centerY - 3, 2) = 9
            battleScreen(centerX - 4, centerY + 3, 1) = 219: battleScreen(centerX - 4, centerY + 3, 2) = 9
            battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 9
            battleScreen(centerX - 2, centerY + 3, 1) = 219: battleScreen(centerX - 2, centerY + 3, 2) = 9
            battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 9
            battleScreen(centerX - 0, centerY + 3, 1) = 219: battleScreen(centerX - 0, centerY + 3, 2) = 9
            battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 15
            battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 15
            battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 15
            battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 15
            battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 15
            battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 15
            battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 15
            battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 15
            battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 15
            battleScreen(centerX + 4, centerY + 0, 1) = 219: battleScreen(centerX + 4, centerY + 0, 2) = 15
            battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 15
            battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 15
            battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 15
            battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 15
            battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 15
            battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 15
        CASE "W"
            battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 9
            battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 9
            battleScreen(centerX + 2, centerY - 3, 1) = 219: battleScreen(centerX + 2, centerY - 3, 2) = 9
            battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 9
            battleScreen(centerX + 4, centerY - 3, 1) = 219: battleScreen(centerX + 4, centerY - 3, 2) = 9
            battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 9
            battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 9
            battleScreen(centerX + 2, centerY + 3, 1) = 219: battleScreen(centerX + 2, centerY + 3, 2) = 9
            battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 9
            battleScreen(centerX + 4, centerY + 3, 1) = 219: battleScreen(centerX + 4, centerY + 3, 2) = 9
            battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 15
            battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 15
            battleScreen(centerX - 0, centerY - 2, 1) = 219: battleScreen(centerX - 0, centerY - 2, 2) = 15
            battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 15
            battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 15
            battleScreen(centerX - 0, centerY + 2, 1) = 219: battleScreen(centerX - 0, centerY + 2, 2) = 15
            battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 15
            battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 15
            battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 15
            battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 15
            battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 15
            battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 15
            battleScreen(centerX - 4, centerY + 0, 1) = 219: battleScreen(centerX - 4, centerY + 0, 2) = 15
            battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 15
            battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 15
            battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 15
        CASE "S"
            battleScreen(centerX - 3, centerY - 4, 1) = 219: battleScreen(centerX - 3, centerY - 4, 2) = 9
            battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 9
            battleScreen(centerX - 3, centerY - 2, 1) = 219: battleScreen(centerX - 3, centerY - 2, 2) = 9
            battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 9
            battleScreen(centerX - 3, centerY - 0, 1) = 219: battleScreen(centerX - 3, centerY - 0, 2) = 9
            battleScreen(centerX + 3, centerY - 4, 1) = 219: battleScreen(centerX + 3, centerY - 4, 2) = 9
            battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 9
            battleScreen(centerX + 3, centerY - 2, 1) = 219: battleScreen(centerX + 3, centerY - 2, 2) = 9
            battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 9
            battleScreen(centerX + 3, centerY - 0, 1) = 219: battleScreen(centerX + 3, centerY - 0, 2) = 9
            battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 15
            battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 15
            battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 15
            battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 15
            battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 15
            battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 15
            battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 15
            battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 15
            battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 15
            battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 15
            battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 15
            battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 15
            battleScreen(centerX + 0, centerY + 1, 1) = 219: battleScreen(centerX + 0, centerY + 1, 2) = 15
            battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 15
            battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 15
            battleScreen(centerX + 0, centerY + 4, 1) = 219: battleScreen(centerX + 0, centerY + 4, 2) = 15
        CASE "N"
            battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 9
            battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 9
            battleScreen(centerX - 3, centerY + 2, 1) = 219: battleScreen(centerX - 3, centerY + 2, 2) = 9
            battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 9
            battleScreen(centerX - 3, centerY + 4, 1) = 219: battleScreen(centerX - 3, centerY + 4, 2) = 9
            battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 9
            battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 9
            battleScreen(centerX + 3, centerY + 2, 1) = 219: battleScreen(centerX + 3, centerY + 2, 2) = 9
            battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 9
            battleScreen(centerX + 3, centerY + 4, 1) = 219: battleScreen(centerX + 3, centerY + 4, 2) = 9
            battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 15
            battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 15
            battleScreen(centerX - 2, centerY - 0, 1) = 219: battleScreen(centerX - 2, centerY - 0, 2) = 15
            battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 15
            battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 15
            battleScreen(centerX + 2, centerY - 0, 1) = 219: battleScreen(centerX + 2, centerY - 0, 2) = 15
            battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 15
            battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 15
            battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 15
            battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 15
            battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 15
            battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 15
            battleScreen(centerX + 0, centerY - 4, 1) = 219: battleScreen(centerX + 0, centerY - 4, 2) = 15
            battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 15
            battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 15
            battleScreen(centerX + 0, centerY - 1, 1) = 219: battleScreen(centerX + 0, centerY - 1, 2) = 15
    END SELECT
END SUB

SUB EraseEspializer (centerX, centerY, orientation$)
    SELECT CASE orientation$
        CASE "E"
            battleScreen(centerX - 4, centerY - 3, 1) = 219: battleScreen(centerX - 4, centerY - 3, 2) = 0
            battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 0
            battleScreen(centerX - 2, centerY - 3, 1) = 219: battleScreen(centerX - 2, centerY - 3, 2) = 0
            battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 0
            battleScreen(centerX - 0, centerY - 3, 1) = 219: battleScreen(centerX - 0, centerY - 3, 2) = 0
            battleScreen(centerX - 4, centerY + 3, 1) = 219: battleScreen(centerX - 4, centerY + 3, 2) = 0
            battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 0
            battleScreen(centerX - 2, centerY + 3, 1) = 219: battleScreen(centerX - 2, centerY + 3, 2) = 0
            battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 0
            battleScreen(centerX - 0, centerY + 3, 1) = 219: battleScreen(centerX - 0, centerY + 3, 2) = 0
            battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 0
            battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 0
            battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 0
            battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 0
            battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 0
            battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 0
            battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 0
            battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 0
            battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 0
            battleScreen(centerX + 4, centerY + 0, 1) = 219: battleScreen(centerX + 4, centerY + 0, 2) = 0
            battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 0
            battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 0
            battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 0
            battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 0
            battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 0
            battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 0
        CASE "W"
            battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 0
            battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 0
            battleScreen(centerX + 2, centerY - 3, 1) = 219: battleScreen(centerX + 2, centerY - 3, 2) = 0
            battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 0
            battleScreen(centerX + 4, centerY - 3, 1) = 219: battleScreen(centerX + 4, centerY - 3, 2) = 0
            battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 0
            battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 0
            battleScreen(centerX + 2, centerY + 3, 1) = 219: battleScreen(centerX + 2, centerY + 3, 2) = 0
            battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 0
            battleScreen(centerX + 4, centerY + 3, 1) = 219: battleScreen(centerX + 4, centerY + 3, 2) = 0
            battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 0
            battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 0
            battleScreen(centerX - 0, centerY - 2, 1) = 219: battleScreen(centerX - 0, centerY - 2, 2) = 0
            battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 0
            battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 0
            battleScreen(centerX - 0, centerY + 2, 1) = 219: battleScreen(centerX - 0, centerY + 2, 2) = 0
            battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 0
            battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 0
            battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 0
            battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 0
            battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 0
            battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 0
            battleScreen(centerX - 4, centerY + 0, 1) = 219: battleScreen(centerX - 4, centerY + 0, 2) = 0
            battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 0
            battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 0
            battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 0
        CASE "S"
            battleScreen(centerX - 3, centerY - 4, 1) = 219: battleScreen(centerX - 3, centerY - 4, 2) = 0
            battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 0
            battleScreen(centerX - 3, centerY - 2, 1) = 219: battleScreen(centerX - 3, centerY - 2, 2) = 0
            battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 0
            battleScreen(centerX - 3, centerY - 0, 1) = 219: battleScreen(centerX - 3, centerY - 0, 2) = 0
            battleScreen(centerX + 3, centerY - 4, 1) = 219: battleScreen(centerX + 3, centerY - 4, 2) = 0
            battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 0
            battleScreen(centerX + 3, centerY - 2, 1) = 219: battleScreen(centerX + 3, centerY - 2, 2) = 0
            battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 0
            battleScreen(centerX + 3, centerY - 0, 1) = 219: battleScreen(centerX + 3, centerY - 0, 2) = 0
            battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 0
            battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 0
            battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 0
            battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 0
            battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 0
            battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 0
            battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 0
            battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 0
            battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 0
            battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 0
            battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 0
            battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 0
            battleScreen(centerX + 0, centerY + 1, 1) = 219: battleScreen(centerX + 0, centerY + 1, 2) = 0
            battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 0
            battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 0
            battleScreen(centerX + 0, centerY + 4, 1) = 219: battleScreen(centerX + 0, centerY + 4, 2) = 0
        CASE "N"
            battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 0
            battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 0
            battleScreen(centerX - 3, centerY + 2, 1) = 219: battleScreen(centerX - 3, centerY + 2, 2) = 0
            battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 0
            battleScreen(centerX - 3, centerY + 4, 1) = 219: battleScreen(centerX - 3, centerY + 4, 2) = 0
            battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 0
            battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 0
            battleScreen(centerX + 3, centerY + 2, 1) = 219: battleScreen(centerX + 3, centerY + 2, 2) = 0
            battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 0
            battleScreen(centerX + 3, centerY + 4, 1) = 219: battleScreen(centerX + 3, centerY + 4, 2) = 0
            battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 0
            battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 0
            battleScreen(centerX - 2, centerY - 0, 1) = 219: battleScreen(centerX - 2, centerY - 0, 2) = 0
            battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 0
            battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 0
            battleScreen(centerX + 2, centerY - 0, 1) = 219: battleScreen(centerX + 2, centerY - 0, 2) = 0
            battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 0
            battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 0
            battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 0
            battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 0
            battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 0
            battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 0
            battleScreen(centerX + 0, centerY - 4, 1) = 219: battleScreen(centerX + 0, centerY - 4, 2) = 0
            battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 0
            battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 0
            battleScreen(centerX + 0, centerY - 1, 1) = 219: battleScreen(centerX + 0, centerY - 1, 2) = 0
    END SELECT
    CALL PrintBattleScreen
END SUB

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: subscript out of range and suspicious non-appearance
« Reply #1 on: December 07, 2020, 09:20:43 pm »
Hi Jaze, welcome to forum.

I checked your code and it's drawing a ship that moves around with arrow keys, left right and top screen borders, at bottom it stops 50-100 pixels away.

Using version QB64 v1.4 on Windows Laptop.
  [ You are not allowed to view this attachment ]  


Don't need the CALL's PS changed COLOR for 0,0 to COLOR 15, 0 to see if anything showed up.
Code: QB64: [Select]
  1. WIDTH 80, 50
  2.  
  3. CONST shotDelay = 0.03
  4. CONST fireBeep = "L64O3CEGAA"
  5. CONST shipHitBeep = "L64O1EEEEEL16CC"
  6.  
  7. DIM SHARED battleScreen(1 TO 80, 1 TO 45, 1 TO 2)
  8.  
  9. FOR fillY = 1 TO 45
  10.     FOR fillX = 1 TO 80
  11.         battleScreen(fillX, fillY, 1) = 32
  12.         battleScreen(fillX, fillY, 2) = 0
  13.     NEXT fillX
  14. NEXT fillY
  15.  
  16. COLOR 15, 0
  17. LOCATE 1, 1
  18.  
  19. Battle
  20.  
  21. SUB PrintBattleScreen ()
  22.     CLS: LOCATE 1, 1
  23.     FOR printY = 1 TO 45
  24.         FOR printX = 1 TO 80
  25.             IF printX <> 80 THEN
  26.                 COLOR battleScreen(printX, printY, 2), 0
  27.                 PRINT CHR$(battleScreen(printX, printY, 1));
  28.             ELSE
  29.                 COLOR battleScreen(printX, printY, 2), 0
  30.                 PRINT CHR$(battleScreen(printX, printY, 1))
  31.             END IF
  32.         NEXT printX
  33.     NEXT printY
  34.  
  35. SUB RelocateSarain
  36.  
  37.  
  38. SUB Battle
  39.     'randNum% = INT(RND * (max% - min% + 1)) + min%
  40.     xPos = INT(RND * 71) + 5
  41.     yPos = INT(RND * 41) + 5
  42.     intFacing = INT(RND * 4) + 1: IF intFacing = 1 THEN facing$ = "N": IF intFacing = 2 THEN facing$ = "S": IF intFacing = 3 THEN facing$ = "W": IF intFacing = 4 THEN facing$ = "E"
  43.     DrawEspializer xPos, yPos, facing$
  44.     xPos = INT(RND * 71) + 5
  45.     yPos = INT(RND * 41) + 5
  46.     intFacing = INT(RND * 4) + 1: IF intFacing = 1 THEN facing$ = "N": IF intFacing = 2 THEN facing$ = "S": IF intFacing = 3 THEN facing$ = "W": IF intFacing = 4 THEN facing$ = "E"
  47.     DrawSarian xPos, yPos, facing$
  48.     PrintBattleScreen
  49.  
  50.     DO
  51.         whichMove$ = INKEY$
  52.  
  53.         SELECT CASE whichMove$
  54.             CASE CHR$(0) + "H" ' up
  55.                 IF yPos > 5 THEN
  56.                     EraseEspializer xPos, yPos, facing$
  57.                     yPos = yPos - 1: facing$ = "N"
  58.                     DrawEspializer xPos, yPos, facing$
  59.                     PrintBattleScreen
  60.                 END IF
  61.             CASE CHR$(0) + "K" ' left
  62.                 IF xPos > 5 THEN
  63.                     EraseEspializer xPos, yPos, facing$
  64.                     xPos = xPos - 1: facing$ = "W"
  65.                     DrawEspializer xPos, yPos, facing$
  66.                     PrintBattleScreen
  67.                 END IF
  68.             CASE CHR$(0) + "P" ' down
  69.                 IF yPos < 40 THEN
  70.                     EraseEspializer xPos, yPos, facing$
  71.                     yPos = yPos + 1: facing$ = "S"
  72.                     DrawEspializer xPos, yPos, facing$
  73.                     PrintBattleScreen
  74.                 END IF
  75.             CASE CHR$(0) + "M" ' right
  76.                 IF xPos < 75 THEN
  77.                     EraseEspializer xPos, yPos, facing$
  78.                     xPos = xPos + 1: facing$ = "E"
  79.                     DrawEspializer xPos, yPos, facing$
  80.                     PrintBattleScreen
  81.                 END IF
  82.             CASE CHR$(27)
  83.                 END
  84.         END SELECT
  85.         '        _DELAY (0.05)
  86.  
  87.         '        FOR moveIt = 40 TO 50
  88.         '        CALL DrawEspializer(moveIt, 22, "E")
  89.         '        CALL PrintBattleScreen
  90.         '        _DELAY (0.05)
  91.         '        CALL EraseEspializer(moveIt, 22, "E")
  92.         '        CALL PrintBattleScreen
  93.         '        NEXT moveIt
  94.     LOOP UNTIL whichMove$ = CHR$(27)
  95.  
  96. SUB DrawSarian (centerX, centerY, orientation$)
  97.     SELECT CASE orientation$
  98.         CASE "N"
  99.             battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 10
  100.             battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 10
  101.             battleScreen(centerX + 0, centerY - 1, 1) = 219: battleScreen(centerX + 0, centerY - 1, 2) = 10
  102.         CASE "S"
  103.             battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 10
  104.             battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 10
  105.             battleScreen(centerX + 0, centerY + 1, 1) = 219: battleScreen(centerX + 0, centerY + 1, 2) = 10
  106.         CASE "W"
  107.             battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 10
  108.             battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 10
  109.             battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 10
  110.         CASE "E"
  111.             battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 10
  112.             battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 10
  113.             battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 10
  114.     END SELECT
  115.  
  116. SUB EraseSerian (centerx, centery, orientation$)
  117.     SELECT CASE orientation$
  118.         CASE "N"
  119.             battleScreen(centerx - 1, centery + 0, 1) = 219: battleScreen(centerx - 1, centery + 0, 2) = 0
  120.             battleScreen(centerx + 1, centery + 0, 1) = 219: battleScreen(centerx + 1, centery + 0, 2) = 0
  121.             battleScreen(centerx + 0, centery - 1, 1) = 219: battleScreen(centerx + 0, centery - 1, 2) = 0
  122.         CASE "S"
  123.             battleScreen(centerx - 1, centery + 0, 1) = 219: battleScreen(centerx - 1, centery + 0, 2) = 0
  124.             battleScreen(centerx + 1, centery + 0, 1) = 219: battleScreen(centerx + 1, centery + 0, 2) = 0
  125.             battleScreen(centerx + 0, centery + 1, 1) = 219: battleScreen(centerx + 0, centery + 1, 2) = 0
  126.         CASE "W"
  127.             battleScreen(centerx - 1, centery + 0, 1) = 219: battleScreen(centerx - 1, centery + 0, 2) = 0
  128.             battleScreen(centerx + 1, centery - 1, 1) = 219: battleScreen(centerx + 1, centery - 1, 2) = 0
  129.             battleScreen(centerx + 1, centery + 1, 1) = 219: battleScreen(centerx + 1, centery + 1, 2) = 0
  130.         CASE "E"
  131.             battleScreen(centerx + 1, centery + 0, 1) = 219: battleScreen(centerx + 1, centery + 0, 2) = 0
  132.             battleScreen(centerx - 1, centery - 1, 1) = 219: battleScreen(centerx - 1, centery - 1, 2) = 0
  133.             battleScreen(centerx - 1, centery + 1, 1) = 219: battleScreen(centerx - 1, centery + 1, 2) = 0
  134.     END SELECT
  135.  
  136.  
  137. SUB DrawEspializer (centerX, centerY, orientation$)
  138.     SELECT CASE orientation$
  139.         CASE "E"
  140.             battleScreen(centerX - 4, centerY - 3, 1) = 219: battleScreen(centerX - 4, centerY - 3, 2) = 9
  141.             battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 9
  142.             battleScreen(centerX - 2, centerY - 3, 1) = 219: battleScreen(centerX - 2, centerY - 3, 2) = 9
  143.             battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 9
  144.             battleScreen(centerX - 0, centerY - 3, 1) = 219: battleScreen(centerX - 0, centerY - 3, 2) = 9
  145.             battleScreen(centerX - 4, centerY + 3, 1) = 219: battleScreen(centerX - 4, centerY + 3, 2) = 9
  146.             battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 9
  147.             battleScreen(centerX - 2, centerY + 3, 1) = 219: battleScreen(centerX - 2, centerY + 3, 2) = 9
  148.             battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 9
  149.             battleScreen(centerX - 0, centerY + 3, 1) = 219: battleScreen(centerX - 0, centerY + 3, 2) = 9
  150.             battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 15
  151.             battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 15
  152.             battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 15
  153.             battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 15
  154.             battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 15
  155.             battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 15
  156.             battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 15
  157.             battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 15
  158.             battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 15
  159.             battleScreen(centerX + 4, centerY + 0, 1) = 219: battleScreen(centerX + 4, centerY + 0, 2) = 15
  160.             battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 15
  161.             battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 15
  162.             battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 15
  163.             battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 15
  164.             battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 15
  165.             battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 15
  166.         CASE "W"
  167.             battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 9
  168.             battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 9
  169.             battleScreen(centerX + 2, centerY - 3, 1) = 219: battleScreen(centerX + 2, centerY - 3, 2) = 9
  170.             battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 9
  171.             battleScreen(centerX + 4, centerY - 3, 1) = 219: battleScreen(centerX + 4, centerY - 3, 2) = 9
  172.             battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 9
  173.             battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 9
  174.             battleScreen(centerX + 2, centerY + 3, 1) = 219: battleScreen(centerX + 2, centerY + 3, 2) = 9
  175.             battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 9
  176.             battleScreen(centerX + 4, centerY + 3, 1) = 219: battleScreen(centerX + 4, centerY + 3, 2) = 9
  177.             battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 15
  178.             battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 15
  179.             battleScreen(centerX - 0, centerY - 2, 1) = 219: battleScreen(centerX - 0, centerY - 2, 2) = 15
  180.             battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 15
  181.             battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 15
  182.             battleScreen(centerX - 0, centerY + 2, 1) = 219: battleScreen(centerX - 0, centerY + 2, 2) = 15
  183.             battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 15
  184.             battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 15
  185.             battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 15
  186.             battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 15
  187.             battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 15
  188.             battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 15
  189.             battleScreen(centerX - 4, centerY + 0, 1) = 219: battleScreen(centerX - 4, centerY + 0, 2) = 15
  190.             battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 15
  191.             battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 15
  192.             battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 15
  193.         CASE "S"
  194.             battleScreen(centerX - 3, centerY - 4, 1) = 219: battleScreen(centerX - 3, centerY - 4, 2) = 9
  195.             battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 9
  196.             battleScreen(centerX - 3, centerY - 2, 1) = 219: battleScreen(centerX - 3, centerY - 2, 2) = 9
  197.             battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 9
  198.             battleScreen(centerX - 3, centerY - 0, 1) = 219: battleScreen(centerX - 3, centerY - 0, 2) = 9
  199.             battleScreen(centerX + 3, centerY - 4, 1) = 219: battleScreen(centerX + 3, centerY - 4, 2) = 9
  200.             battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 9
  201.             battleScreen(centerX + 3, centerY - 2, 1) = 219: battleScreen(centerX + 3, centerY - 2, 2) = 9
  202.             battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 9
  203.             battleScreen(centerX + 3, centerY - 0, 1) = 219: battleScreen(centerX + 3, centerY - 0, 2) = 9
  204.             battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 15
  205.             battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 15
  206.             battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 15
  207.             battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 15
  208.             battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 15
  209.             battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 15
  210.             battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 15
  211.             battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 15
  212.             battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 15
  213.             battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 15
  214.             battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 15
  215.             battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 15
  216.             battleScreen(centerX + 0, centerY + 1, 1) = 219: battleScreen(centerX + 0, centerY + 1, 2) = 15
  217.             battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 15
  218.             battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 15
  219.             battleScreen(centerX + 0, centerY + 4, 1) = 219: battleScreen(centerX + 0, centerY + 4, 2) = 15
  220.         CASE "N"
  221.             battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 9
  222.             battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 9
  223.             battleScreen(centerX - 3, centerY + 2, 1) = 219: battleScreen(centerX - 3, centerY + 2, 2) = 9
  224.             battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 9
  225.             battleScreen(centerX - 3, centerY + 4, 1) = 219: battleScreen(centerX - 3, centerY + 4, 2) = 9
  226.             battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 9
  227.             battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 9
  228.             battleScreen(centerX + 3, centerY + 2, 1) = 219: battleScreen(centerX + 3, centerY + 2, 2) = 9
  229.             battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 9
  230.             battleScreen(centerX + 3, centerY + 4, 1) = 219: battleScreen(centerX + 3, centerY + 4, 2) = 9
  231.             battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 15
  232.             battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 15
  233.             battleScreen(centerX - 2, centerY - 0, 1) = 219: battleScreen(centerX - 2, centerY - 0, 2) = 15
  234.             battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 15
  235.             battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 15
  236.             battleScreen(centerX + 2, centerY - 0, 1) = 219: battleScreen(centerX + 2, centerY - 0, 2) = 15
  237.             battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 15
  238.             battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 15
  239.             battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 15
  240.             battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 15
  241.             battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 15
  242.             battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 15
  243.             battleScreen(centerX + 0, centerY - 4, 1) = 219: battleScreen(centerX + 0, centerY - 4, 2) = 15
  244.             battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 15
  245.             battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 15
  246.             battleScreen(centerX + 0, centerY - 1, 1) = 219: battleScreen(centerX + 0, centerY - 1, 2) = 15
  247.     END SELECT
  248.  
  249. SUB EraseEspializer (centerX, centerY, orientation$)
  250.     SELECT CASE orientation$
  251.         CASE "E"
  252.             battleScreen(centerX - 4, centerY - 3, 1) = 219: battleScreen(centerX - 4, centerY - 3, 2) = 0
  253.             battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 0
  254.             battleScreen(centerX - 2, centerY - 3, 1) = 219: battleScreen(centerX - 2, centerY - 3, 2) = 0
  255.             battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 0
  256.             battleScreen(centerX - 0, centerY - 3, 1) = 219: battleScreen(centerX - 0, centerY - 3, 2) = 0
  257.             battleScreen(centerX - 4, centerY + 3, 1) = 219: battleScreen(centerX - 4, centerY + 3, 2) = 0
  258.             battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 0
  259.             battleScreen(centerX - 2, centerY + 3, 1) = 219: battleScreen(centerX - 2, centerY + 3, 2) = 0
  260.             battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 0
  261.             battleScreen(centerX - 0, centerY + 3, 1) = 219: battleScreen(centerX - 0, centerY + 3, 2) = 0
  262.             battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 0
  263.             battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 0
  264.             battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 0
  265.             battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 0
  266.             battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 0
  267.             battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 0
  268.             battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 0
  269.             battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 0
  270.             battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 0
  271.             battleScreen(centerX + 4, centerY + 0, 1) = 219: battleScreen(centerX + 4, centerY + 0, 2) = 0
  272.             battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 0
  273.             battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 0
  274.             battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 0
  275.             battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 0
  276.             battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 0
  277.             battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 0
  278.         CASE "W"
  279.             battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 0
  280.             battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 0
  281.             battleScreen(centerX + 2, centerY - 3, 1) = 219: battleScreen(centerX + 2, centerY - 3, 2) = 0
  282.             battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 0
  283.             battleScreen(centerX + 4, centerY - 3, 1) = 219: battleScreen(centerX + 4, centerY - 3, 2) = 0
  284.             battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 0
  285.             battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 0
  286.             battleScreen(centerX + 2, centerY + 3, 1) = 219: battleScreen(centerX + 2, centerY + 3, 2) = 0
  287.             battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 0
  288.             battleScreen(centerX + 4, centerY + 3, 1) = 219: battleScreen(centerX + 4, centerY + 3, 2) = 0
  289.             battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 0
  290.             battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 0
  291.             battleScreen(centerX - 0, centerY - 2, 1) = 219: battleScreen(centerX - 0, centerY - 2, 2) = 0
  292.             battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 0
  293.             battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 0
  294.             battleScreen(centerX - 0, centerY + 2, 1) = 219: battleScreen(centerX - 0, centerY + 2, 2) = 0
  295.             battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 0
  296.             battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 0
  297.             battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 0
  298.             battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 0
  299.             battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 0
  300.             battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 0
  301.             battleScreen(centerX - 4, centerY + 0, 1) = 219: battleScreen(centerX - 4, centerY + 0, 2) = 0
  302.             battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 0
  303.             battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 0
  304.             battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 0
  305.         CASE "S"
  306.             battleScreen(centerX - 3, centerY - 4, 1) = 219: battleScreen(centerX - 3, centerY - 4, 2) = 0
  307.             battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 0
  308.             battleScreen(centerX - 3, centerY - 2, 1) = 219: battleScreen(centerX - 3, centerY - 2, 2) = 0
  309.             battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 0
  310.             battleScreen(centerX - 3, centerY - 0, 1) = 219: battleScreen(centerX - 3, centerY - 0, 2) = 0
  311.             battleScreen(centerX + 3, centerY - 4, 1) = 219: battleScreen(centerX + 3, centerY - 4, 2) = 0
  312.             battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 0
  313.             battleScreen(centerX + 3, centerY - 2, 1) = 219: battleScreen(centerX + 3, centerY - 2, 2) = 0
  314.             battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 0
  315.             battleScreen(centerX + 3, centerY - 0, 1) = 219: battleScreen(centerX + 3, centerY - 0, 2) = 0
  316.             battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 0
  317.             battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 0
  318.             battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 0
  319.             battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 0
  320.             battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 0
  321.             battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 0
  322.             battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 0
  323.             battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 0
  324.             battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 0
  325.             battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 0
  326.             battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 0
  327.             battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 0
  328.             battleScreen(centerX + 0, centerY + 1, 1) = 219: battleScreen(centerX + 0, centerY + 1, 2) = 0
  329.             battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 0
  330.             battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 0
  331.             battleScreen(centerX + 0, centerY + 4, 1) = 219: battleScreen(centerX + 0, centerY + 4, 2) = 0
  332.         CASE "N"
  333.             battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 0
  334.             battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 0
  335.             battleScreen(centerX - 3, centerY + 2, 1) = 219: battleScreen(centerX - 3, centerY + 2, 2) = 0
  336.             battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 0
  337.             battleScreen(centerX - 3, centerY + 4, 1) = 219: battleScreen(centerX - 3, centerY + 4, 2) = 0
  338.             battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 0
  339.             battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 0
  340.             battleScreen(centerX + 3, centerY + 2, 1) = 219: battleScreen(centerX + 3, centerY + 2, 2) = 0
  341.             battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 0
  342.             battleScreen(centerX + 3, centerY + 4, 1) = 219: battleScreen(centerX + 3, centerY + 4, 2) = 0
  343.             battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 0
  344.             battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 0
  345.             battleScreen(centerX - 2, centerY - 0, 1) = 219: battleScreen(centerX - 2, centerY - 0, 2) = 0
  346.             battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 0
  347.             battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 0
  348.             battleScreen(centerX + 2, centerY - 0, 1) = 219: battleScreen(centerX + 2, centerY - 0, 2) = 0
  349.             battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 0
  350.             battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 0
  351.             battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 0
  352.             battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 0
  353.             battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 0
  354.             battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 0
  355.             battleScreen(centerX + 0, centerY - 4, 1) = 219: battleScreen(centerX + 0, centerY - 4, 2) = 0
  356.             battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 0
  357.             battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 0
  358.             battleScreen(centerX + 0, centerY - 1, 1) = 219: battleScreen(centerX + 0, centerY - 1, 2) = 0
  359.     END SELECT
  360.     PrintBattleScreen
  361.  
  362.  
« Last Edit: December 07, 2020, 09:33:10 pm by bplus »

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: subscript out of range and suspicious non-appearance
« Reply #2 on: December 07, 2020, 09:30:33 pm »
Nothing inside SUB?


Quote
SUB RelocateSarain

END SUB

label RelocateSarain does not exist

« Last Edit: December 07, 2020, 09:33:20 pm by NOVARSEG »

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: subscript out of range and suspicious non-appearance
« Reply #3 on: December 08, 2020, 02:47:01 am »
.
« Last Edit: December 08, 2020, 03:42:39 am by NOVARSEG »

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: subscript out of range and suspicious non-appearance
« Reply #4 on: December 08, 2020, 08:27:49 am »
@Jaze
Welcome to the forum!
I'd really recommend you use the QB64 code block option when posting code. It looks like a pound sign or a hash symbol below the italics button. Just highlight your code and press that button and it will format it to be in QB64 highlighting and make it scrollable. Makes it much easier to read.
Shuwatch!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: subscript out of range and suspicious non-appearance
« Reply #5 on: December 08, 2020, 09:40:57 am »
Hi Jaze
your code works fine without error on my notebook with Windows 10.

just a question, do you live the part at bottom of screen for output like lives, score and message to user?

Welcome.
If you let me say: I don't like main without an end (END or SYSTEM), but until it is working it is another way to write code.
Programming isn't difficult, only it's  consuming time and coffee

Marked as best answer by Jaze on December 08, 2020, 04:23:37 pm

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: subscript out of range and suspicious non-appearance
« Reply #6 on: December 08, 2020, 10:06:22 am »
One thing that might be causing you an issue is these style lines:

Code: QB64: [Select]
  1. intFacing = INT(RND * 4) + 1: IF intFacing = 1 THEN facing$ = "N": IF intFacing = 2 THEN facing$ = "S": IF intFacing = 3 THEN facing$ = "W": IF intFacing = 4 THEN facing$ = "E"

You can't stack IF statements in such a manner.  Everything to the right of that first THEN is part of the intFacing = 1 conditional...   See the below for proof:

Code: QB64: [Select]
  1. intFacing = 1: IF intFacing = 1 THEN facing$ = "N": IF intFacing = 2 THEN facing$ = "S": IF intFacing = 3 THEN facing$ = "W": IF intFacing = 4 THEN facing$ = "E"
  2. PRINT facing$
  3.  
  4. intFacing = 2: IF intFacing = 1 THEN facing$ = "N": IF intFacing = 2 THEN facing$ = "S": IF intFacing = 3 THEN facing$ = "W": IF intFacing = 4 THEN facing$ = "E"
  5. PRINT facing$
  6.  
  7. intFacing = 3: IF intFacing = 1 THEN facing$ = "N": IF intFacing = 2 THEN facing$ = "S": IF intFacing = 3 THEN facing$ = "W": IF intFacing = 4 THEN facing$ = "E"
  8. PRINT facing$
  9.  
  10. intFacing = 4: IF intFacing = 1 THEN facing$ = "N": IF intFacing = 2 THEN facing$ = "S": IF intFacing = 3 THEN facing$ = "W": IF intFacing = 4 THEN facing$ = "E"
  11. PRINT facing$

You're not changing the facing as you intend with the above, which might be causing issues elsewhere in the code.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: subscript out of range and suspicious non-appearance
« Reply #7 on: December 08, 2020, 10:23:18 am »
Hey Steve that gives us 2 ships now! plus I uncommented the troubled section that shows errors Jaze spoke of:

Code: QB64: [Select]
  1. WIDTH 80, 50
  2.  
  3. CONST shotDelay = 0.03
  4. CONST fireBeep = "L64O3CEGAA"
  5. CONST shipHitBeep = "L64O1EEEEEL16CC"
  6.  
  7. DIM SHARED battleScreen(1 TO 80, 1 TO 45, 1 TO 2)
  8.  
  9. FOR fillY = 1 TO 45
  10.     FOR fillX = 1 TO 80
  11.         battleScreen(fillX, fillY, 1) = 32
  12.         battleScreen(fillX, fillY, 2) = 0
  13.     NEXT fillX
  14. NEXT fillY
  15.  
  16. COLOR 15, 0
  17. LOCATE 1, 1
  18.  
  19. Battle
  20.  
  21. SUB PrintBattleScreen ()
  22.     CLS: LOCATE 1, 1
  23.     FOR printY = 1 TO 45
  24.         FOR printX = 1 TO 80
  25.             IF printX <> 80 THEN
  26.                 COLOR battleScreen(printX, printY, 2), 0
  27.                 PRINT CHR$(battleScreen(printX, printY, 1));
  28.             ELSE
  29.                 COLOR battleScreen(printX, printY, 2), 0
  30.                 PRINT CHR$(battleScreen(printX, printY, 1))
  31.             END IF
  32.         NEXT printX
  33.     NEXT printY
  34.  
  35. SUB RelocateSarain
  36.  
  37.  
  38. SUB Battle
  39.     'randNum% = INT(RND * (max% - min% + 1)) + min%
  40.     xPos = INT(RND * 71) + 5
  41.     yPos = INT(RND * 41) + 5
  42.     intFacing = INT(RND * 4) + 1
  43.     IF intFacing = 1 THEN facing$ = "N"
  44.     IF intFacing = 2 THEN facing$ = "S"
  45.     IF intFacing = 3 THEN facing$ = "W"
  46.     IF intFacing = 4 THEN facing$ = "E"
  47.     DrawEspializer xPos, yPos, facing$
  48.     xPos = INT(RND * 71) + 5
  49.     yPos = INT(RND * 41) + 5
  50.     intFacing = INT(RND * 4) + 1
  51.     IF intFacing = 1 THEN facing$ = "N"
  52.     IF intFacing = 2 THEN facing$ = "S"
  53.     IF intFacing = 3 THEN facing$ = "W"
  54.     IF intFacing = 4 THEN facing$ = "E"
  55.     DrawSarian xPos, yPos, facing$
  56.     PrintBattleScreen
  57.  
  58.     DO
  59.         whichMove$ = INKEY$
  60.  
  61.         SELECT CASE whichMove$
  62.             CASE CHR$(0) + "H" ' up
  63.                 IF yPos > 5 THEN
  64.                     EraseEspializer xPos, yPos, facing$
  65.                     yPos = yPos - 1: facing$ = "N"
  66.                     DrawEspializer xPos, yPos, facing$
  67.                     PrintBattleScreen
  68.                 END IF
  69.             CASE CHR$(0) + "K" ' left
  70.                 IF xPos > 5 THEN
  71.                     EraseEspializer xPos, yPos, facing$
  72.                     xPos = xPos - 1: facing$ = "W"
  73.                     DrawEspializer xPos, yPos, facing$
  74.                     PrintBattleScreen
  75.                 END IF
  76.             CASE CHR$(0) + "P" ' down
  77.                 IF yPos < 40 THEN
  78.                     EraseEspializer xPos, yPos, facing$
  79.                     yPos = yPos + 1: facing$ = "S"
  80.                     DrawEspializer xPos, yPos, facing$
  81.                     PrintBattleScreen
  82.                 END IF
  83.             CASE CHR$(0) + "M" ' right
  84.                 IF xPos < 75 THEN
  85.                     EraseEspializer xPos, yPos, facing$
  86.                     xPos = xPos + 1: facing$ = "E"
  87.                     DrawEspializer xPos, yPos, facing$
  88.                     PrintBattleScreen
  89.                 END IF
  90.             CASE CHR$(27)
  91.                 END
  92.         END SELECT
  93.  
  94.         ' ============================================================ ah here is troubled section
  95.         FOR moveIt = 40 TO 50
  96.             DrawEspializer moveIt, 22, "E"
  97.             PrintBattleScreen
  98.             ' xxx out the delay here
  99.             EraseEspializer moveIt, 22, "E"
  100.             PrintBattleScreen
  101.         NEXT moveIt
  102.         _DISPLAY ' <<<<<<<<<<<< stop blinking
  103.         _LIMIT 10 ' <<<<<<<<<<<<, limit how fast to go  replaced delays
  104.     LOOP UNTIL whichMove$ = CHR$(27)
  105.  
  106. SUB DrawSarian (centerX, centerY, orientation$)
  107.     SELECT CASE orientation$
  108.         CASE "N"
  109.             battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 10
  110.             battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 10
  111.             battleScreen(centerX + 0, centerY - 1, 1) = 219: battleScreen(centerX + 0, centerY - 1, 2) = 10
  112.         CASE "S"
  113.             battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 10
  114.             battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 10
  115.             battleScreen(centerX + 0, centerY + 1, 1) = 219: battleScreen(centerX + 0, centerY + 1, 2) = 10
  116.         CASE "W"
  117.             battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 10
  118.             battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 10
  119.             battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 10
  120.         CASE "E"
  121.             battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 10
  122.             battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 10
  123.             battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 10
  124.     END SELECT
  125.  
  126. SUB EraseSerian (centerx, centery, orientation$)
  127.     SELECT CASE orientation$
  128.         CASE "N"
  129.             battleScreen(centerx - 1, centery + 0, 1) = 219: battleScreen(centerx - 1, centery + 0, 2) = 0
  130.             battleScreen(centerx + 1, centery + 0, 1) = 219: battleScreen(centerx + 1, centery + 0, 2) = 0
  131.             battleScreen(centerx + 0, centery - 1, 1) = 219: battleScreen(centerx + 0, centery - 1, 2) = 0
  132.         CASE "S"
  133.             battleScreen(centerx - 1, centery + 0, 1) = 219: battleScreen(centerx - 1, centery + 0, 2) = 0
  134.             battleScreen(centerx + 1, centery + 0, 1) = 219: battleScreen(centerx + 1, centery + 0, 2) = 0
  135.             battleScreen(centerx + 0, centery + 1, 1) = 219: battleScreen(centerx + 0, centery + 1, 2) = 0
  136.         CASE "W"
  137.             battleScreen(centerx - 1, centery + 0, 1) = 219: battleScreen(centerx - 1, centery + 0, 2) = 0
  138.             battleScreen(centerx + 1, centery - 1, 1) = 219: battleScreen(centerx + 1, centery - 1, 2) = 0
  139.             battleScreen(centerx + 1, centery + 1, 1) = 219: battleScreen(centerx + 1, centery + 1, 2) = 0
  140.         CASE "E"
  141.             battleScreen(centerx + 1, centery + 0, 1) = 219: battleScreen(centerx + 1, centery + 0, 2) = 0
  142.             battleScreen(centerx - 1, centery - 1, 1) = 219: battleScreen(centerx - 1, centery - 1, 2) = 0
  143.             battleScreen(centerx - 1, centery + 1, 1) = 219: battleScreen(centerx - 1, centery + 1, 2) = 0
  144.     END SELECT
  145.  
  146.  
  147. SUB DrawEspializer (centerX, centerY, orientation$)
  148.     SELECT CASE orientation$
  149.         CASE "E"
  150.             battleScreen(centerX - 4, centerY - 3, 1) = 219: battleScreen(centerX - 4, centerY - 3, 2) = 9
  151.             battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 9
  152.             battleScreen(centerX - 2, centerY - 3, 1) = 219: battleScreen(centerX - 2, centerY - 3, 2) = 9
  153.             battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 9
  154.             battleScreen(centerX - 0, centerY - 3, 1) = 219: battleScreen(centerX - 0, centerY - 3, 2) = 9
  155.             battleScreen(centerX - 4, centerY + 3, 1) = 219: battleScreen(centerX - 4, centerY + 3, 2) = 9
  156.             battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 9
  157.             battleScreen(centerX - 2, centerY + 3, 1) = 219: battleScreen(centerX - 2, centerY + 3, 2) = 9
  158.             battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 9
  159.             battleScreen(centerX - 0, centerY + 3, 1) = 219: battleScreen(centerX - 0, centerY + 3, 2) = 9
  160.             battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 15
  161.             battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 15
  162.             battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 15
  163.             battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 15
  164.             battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 15
  165.             battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 15
  166.             battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 15
  167.             battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 15
  168.             battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 15
  169.             battleScreen(centerX + 4, centerY + 0, 1) = 219: battleScreen(centerX + 4, centerY + 0, 2) = 15
  170.             battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 15
  171.             battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 15
  172.             battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 15
  173.             battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 15
  174.             battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 15
  175.             battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 15
  176.         CASE "W"
  177.             battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 9
  178.             battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 9
  179.             battleScreen(centerX + 2, centerY - 3, 1) = 219: battleScreen(centerX + 2, centerY - 3, 2) = 9
  180.             battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 9
  181.             battleScreen(centerX + 4, centerY - 3, 1) = 219: battleScreen(centerX + 4, centerY - 3, 2) = 9
  182.             battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 9
  183.             battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 9
  184.             battleScreen(centerX + 2, centerY + 3, 1) = 219: battleScreen(centerX + 2, centerY + 3, 2) = 9
  185.             battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 9
  186.             battleScreen(centerX + 4, centerY + 3, 1) = 219: battleScreen(centerX + 4, centerY + 3, 2) = 9
  187.             battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 15
  188.             battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 15
  189.             battleScreen(centerX - 0, centerY - 2, 1) = 219: battleScreen(centerX - 0, centerY - 2, 2) = 15
  190.             battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 15
  191.             battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 15
  192.             battleScreen(centerX - 0, centerY + 2, 1) = 219: battleScreen(centerX - 0, centerY + 2, 2) = 15
  193.             battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 15
  194.             battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 15
  195.             battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 15
  196.             battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 15
  197.             battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 15
  198.             battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 15
  199.             battleScreen(centerX - 4, centerY + 0, 1) = 219: battleScreen(centerX - 4, centerY + 0, 2) = 15
  200.             battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 15
  201.             battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 15
  202.             battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 15
  203.         CASE "S"
  204.             battleScreen(centerX - 3, centerY - 4, 1) = 219: battleScreen(centerX - 3, centerY - 4, 2) = 9
  205.             battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 9
  206.             battleScreen(centerX - 3, centerY - 2, 1) = 219: battleScreen(centerX - 3, centerY - 2, 2) = 9
  207.             battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 9
  208.             battleScreen(centerX - 3, centerY - 0, 1) = 219: battleScreen(centerX - 3, centerY - 0, 2) = 9
  209.             battleScreen(centerX + 3, centerY - 4, 1) = 219: battleScreen(centerX + 3, centerY - 4, 2) = 9
  210.             battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 9
  211.             battleScreen(centerX + 3, centerY - 2, 1) = 219: battleScreen(centerX + 3, centerY - 2, 2) = 9
  212.             battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 9
  213.             battleScreen(centerX + 3, centerY - 0, 1) = 219: battleScreen(centerX + 3, centerY - 0, 2) = 9
  214.             battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 15
  215.             battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 15
  216.             battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 15
  217.             battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 15
  218.             battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 15
  219.             battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 15
  220.             battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 15
  221.             battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 15
  222.             battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 15
  223.             battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 15
  224.             battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 15
  225.             battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 15
  226.             battleScreen(centerX + 0, centerY + 1, 1) = 219: battleScreen(centerX + 0, centerY + 1, 2) = 15
  227.             battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 15
  228.             battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 15
  229.             battleScreen(centerX + 0, centerY + 4, 1) = 219: battleScreen(centerX + 0, centerY + 4, 2) = 15
  230.         CASE "N"
  231.             battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 9
  232.             battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 9
  233.             battleScreen(centerX - 3, centerY + 2, 1) = 219: battleScreen(centerX - 3, centerY + 2, 2) = 9
  234.             battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 9
  235.             battleScreen(centerX - 3, centerY + 4, 1) = 219: battleScreen(centerX - 3, centerY + 4, 2) = 9
  236.             battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 9
  237.             battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 9
  238.             battleScreen(centerX + 3, centerY + 2, 1) = 219: battleScreen(centerX + 3, centerY + 2, 2) = 9
  239.             battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 9
  240.             battleScreen(centerX + 3, centerY + 4, 1) = 219: battleScreen(centerX + 3, centerY + 4, 2) = 9
  241.             battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 15
  242.             battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 15
  243.             battleScreen(centerX - 2, centerY - 0, 1) = 219: battleScreen(centerX - 2, centerY - 0, 2) = 15
  244.             battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 15
  245.             battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 15
  246.             battleScreen(centerX + 2, centerY - 0, 1) = 219: battleScreen(centerX + 2, centerY - 0, 2) = 15
  247.             battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 15
  248.             battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 15
  249.             battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 15
  250.             battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 15
  251.             battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 15
  252.             battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 15
  253.             battleScreen(centerX + 0, centerY - 4, 1) = 219: battleScreen(centerX + 0, centerY - 4, 2) = 15
  254.             battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 15
  255.             battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 15
  256.             battleScreen(centerX + 0, centerY - 1, 1) = 219: battleScreen(centerX + 0, centerY - 1, 2) = 15
  257.     END SELECT
  258.  
  259. SUB EraseEspializer (centerX, centerY, orientation$)
  260.     SELECT CASE orientation$
  261.         CASE "E"
  262.             battleScreen(centerX - 4, centerY - 3, 1) = 219: battleScreen(centerX - 4, centerY - 3, 2) = 0
  263.             battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 0
  264.             battleScreen(centerX - 2, centerY - 3, 1) = 219: battleScreen(centerX - 2, centerY - 3, 2) = 0
  265.             battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 0
  266.             battleScreen(centerX - 0, centerY - 3, 1) = 219: battleScreen(centerX - 0, centerY - 3, 2) = 0
  267.             battleScreen(centerX - 4, centerY + 3, 1) = 219: battleScreen(centerX - 4, centerY + 3, 2) = 0
  268.             battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 0
  269.             battleScreen(centerX - 2, centerY + 3, 1) = 219: battleScreen(centerX - 2, centerY + 3, 2) = 0
  270.             battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 0
  271.             battleScreen(centerX - 0, centerY + 3, 1) = 219: battleScreen(centerX - 0, centerY + 3, 2) = 0
  272.             battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 0
  273.             battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 0
  274.             battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 0
  275.             battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 0
  276.             battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 0
  277.             battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 0
  278.             battleScreen(centerX + 1, centerY + 0, 1) = 219: battleScreen(centerX + 1, centerY + 0, 2) = 0
  279.             battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 0
  280.             battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 0
  281.             battleScreen(centerX + 4, centerY + 0, 1) = 219: battleScreen(centerX + 4, centerY + 0, 2) = 0
  282.             battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 0
  283.             battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 0
  284.             battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 0
  285.             battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 0
  286.             battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 0
  287.             battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 0
  288.         CASE "W"
  289.             battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 0
  290.             battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 0
  291.             battleScreen(centerX + 2, centerY - 3, 1) = 219: battleScreen(centerX + 2, centerY - 3, 2) = 0
  292.             battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 0
  293.             battleScreen(centerX + 4, centerY - 3, 1) = 219: battleScreen(centerX + 4, centerY - 3, 2) = 0
  294.             battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 0
  295.             battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 0
  296.             battleScreen(centerX + 2, centerY + 3, 1) = 219: battleScreen(centerX + 2, centerY + 3, 2) = 0
  297.             battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 0
  298.             battleScreen(centerX + 4, centerY + 3, 1) = 219: battleScreen(centerX + 4, centerY + 3, 2) = 0
  299.             battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 0
  300.             battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 0
  301.             battleScreen(centerX - 0, centerY - 2, 1) = 219: battleScreen(centerX - 0, centerY - 2, 2) = 0
  302.             battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 0
  303.             battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 0
  304.             battleScreen(centerX - 0, centerY + 2, 1) = 219: battleScreen(centerX - 0, centerY + 2, 2) = 0
  305.             battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 0
  306.             battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 0
  307.             battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 0
  308.             battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 0
  309.             battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 0
  310.             battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 0
  311.             battleScreen(centerX - 4, centerY + 0, 1) = 219: battleScreen(centerX - 4, centerY + 0, 2) = 0
  312.             battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 0
  313.             battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 0
  314.             battleScreen(centerX - 1, centerY + 0, 1) = 219: battleScreen(centerX - 1, centerY + 0, 2) = 0
  315.         CASE "S"
  316.             battleScreen(centerX - 3, centerY - 4, 1) = 219: battleScreen(centerX - 3, centerY - 4, 2) = 0
  317.             battleScreen(centerX - 3, centerY - 3, 1) = 219: battleScreen(centerX - 3, centerY - 3, 2) = 0
  318.             battleScreen(centerX - 3, centerY - 2, 1) = 219: battleScreen(centerX - 3, centerY - 2, 2) = 0
  319.             battleScreen(centerX - 3, centerY - 1, 1) = 219: battleScreen(centerX - 3, centerY - 1, 2) = 0
  320.             battleScreen(centerX - 3, centerY - 0, 1) = 219: battleScreen(centerX - 3, centerY - 0, 2) = 0
  321.             battleScreen(centerX + 3, centerY - 4, 1) = 219: battleScreen(centerX + 3, centerY - 4, 2) = 0
  322.             battleScreen(centerX + 3, centerY - 3, 1) = 219: battleScreen(centerX + 3, centerY - 3, 2) = 0
  323.             battleScreen(centerX + 3, centerY - 2, 1) = 219: battleScreen(centerX + 3, centerY - 2, 2) = 0
  324.             battleScreen(centerX + 3, centerY - 1, 1) = 219: battleScreen(centerX + 3, centerY - 1, 2) = 0
  325.             battleScreen(centerX + 3, centerY - 0, 1) = 219: battleScreen(centerX + 3, centerY - 0, 2) = 0
  326.             battleScreen(centerX - 2, centerY + 0, 1) = 219: battleScreen(centerX - 2, centerY + 0, 2) = 0
  327.             battleScreen(centerX - 2, centerY + 1, 1) = 219: battleScreen(centerX - 2, centerY + 1, 2) = 0
  328.             battleScreen(centerX - 2, centerY + 2, 1) = 219: battleScreen(centerX - 2, centerY + 2, 2) = 0
  329.             battleScreen(centerX + 2, centerY + 0, 1) = 219: battleScreen(centerX + 2, centerY + 0, 2) = 0
  330.             battleScreen(centerX + 2, centerY + 1, 1) = 219: battleScreen(centerX + 2, centerY + 1, 2) = 0
  331.             battleScreen(centerX + 2, centerY + 2, 1) = 219: battleScreen(centerX + 2, centerY + 2, 2) = 0
  332.             battleScreen(centerX - 1, centerY + 1, 1) = 219: battleScreen(centerX - 1, centerY + 1, 2) = 0
  333.             battleScreen(centerX - 1, centerY + 2, 1) = 219: battleScreen(centerX - 1, centerY + 2, 2) = 0
  334.             battleScreen(centerX - 1, centerY + 3, 1) = 219: battleScreen(centerX - 1, centerY + 3, 2) = 0
  335.             battleScreen(centerX + 1, centerY + 1, 1) = 219: battleScreen(centerX + 1, centerY + 1, 2) = 0
  336.             battleScreen(centerX + 1, centerY + 2, 1) = 219: battleScreen(centerX + 1, centerY + 2, 2) = 0
  337.             battleScreen(centerX + 1, centerY + 3, 1) = 219: battleScreen(centerX + 1, centerY + 3, 2) = 0
  338.             battleScreen(centerX + 0, centerY + 1, 1) = 219: battleScreen(centerX + 0, centerY + 1, 2) = 0
  339.             battleScreen(centerX + 0, centerY + 2, 1) = 219: battleScreen(centerX + 0, centerY + 2, 2) = 0
  340.             battleScreen(centerX + 0, centerY + 3, 1) = 219: battleScreen(centerX + 0, centerY + 3, 2) = 0
  341.             battleScreen(centerX + 0, centerY + 4, 1) = 219: battleScreen(centerX + 0, centerY + 4, 2) = 0
  342.         CASE "N"
  343.             battleScreen(centerX - 3, centerY + 0, 1) = 219: battleScreen(centerX - 3, centerY + 0, 2) = 0
  344.             battleScreen(centerX - 3, centerY + 1, 1) = 219: battleScreen(centerX - 3, centerY + 1, 2) = 0
  345.             battleScreen(centerX - 3, centerY + 2, 1) = 219: battleScreen(centerX - 3, centerY + 2, 2) = 0
  346.             battleScreen(centerX - 3, centerY + 3, 1) = 219: battleScreen(centerX - 3, centerY + 3, 2) = 0
  347.             battleScreen(centerX - 3, centerY + 4, 1) = 219: battleScreen(centerX - 3, centerY + 4, 2) = 0
  348.             battleScreen(centerX + 3, centerY + 0, 1) = 219: battleScreen(centerX + 3, centerY + 0, 2) = 0
  349.             battleScreen(centerX + 3, centerY + 1, 1) = 219: battleScreen(centerX + 3, centerY + 1, 2) = 0
  350.             battleScreen(centerX + 3, centerY + 2, 1) = 219: battleScreen(centerX + 3, centerY + 2, 2) = 0
  351.             battleScreen(centerX + 3, centerY + 3, 1) = 219: battleScreen(centerX + 3, centerY + 3, 2) = 0
  352.             battleScreen(centerX + 3, centerY + 4, 1) = 219: battleScreen(centerX + 3, centerY + 4, 2) = 0
  353.             battleScreen(centerX - 2, centerY - 2, 1) = 219: battleScreen(centerX - 2, centerY - 2, 2) = 0
  354.             battleScreen(centerX - 2, centerY - 1, 1) = 219: battleScreen(centerX - 2, centerY - 1, 2) = 0
  355.             battleScreen(centerX - 2, centerY - 0, 1) = 219: battleScreen(centerX - 2, centerY - 0, 2) = 0
  356.             battleScreen(centerX + 2, centerY - 2, 1) = 219: battleScreen(centerX + 2, centerY - 2, 2) = 0
  357.             battleScreen(centerX + 2, centerY - 1, 1) = 219: battleScreen(centerX + 2, centerY - 1, 2) = 0
  358.             battleScreen(centerX + 2, centerY - 0, 1) = 219: battleScreen(centerX + 2, centerY - 0, 2) = 0
  359.             battleScreen(centerX - 1, centerY - 3, 1) = 219: battleScreen(centerX - 1, centerY - 3, 2) = 0
  360.             battleScreen(centerX - 1, centerY - 2, 1) = 219: battleScreen(centerX - 1, centerY - 2, 2) = 0
  361.             battleScreen(centerX - 1, centerY - 1, 1) = 219: battleScreen(centerX - 1, centerY - 1, 2) = 0
  362.             battleScreen(centerX + 1, centerY - 3, 1) = 219: battleScreen(centerX + 1, centerY - 3, 2) = 0
  363.             battleScreen(centerX + 1, centerY - 2, 1) = 219: battleScreen(centerX + 1, centerY - 2, 2) = 0
  364.             battleScreen(centerX + 1, centerY - 1, 1) = 219: battleScreen(centerX + 1, centerY - 1, 2) = 0
  365.             battleScreen(centerX + 0, centerY - 4, 1) = 219: battleScreen(centerX + 0, centerY - 4, 2) = 0
  366.             battleScreen(centerX + 0, centerY - 3, 1) = 219: battleScreen(centerX + 0, centerY - 3, 2) = 0
  367.             battleScreen(centerX + 0, centerY - 2, 1) = 219: battleScreen(centerX + 0, centerY - 2, 2) = 0
  368.             battleScreen(centerX + 0, centerY - 1, 1) = 219: battleScreen(centerX + 0, centerY - 1, 2) = 0
  369.     END SELECT
  370.     PrintBattleScreen
  371.  
  372.  
  373.  
  374.  

PS I dumped the DELAYs and added _DISPLAY to stop blinking and _LIMIT to control speed of Looping for drawn frames
ie _LIMIT X     ' is X loops maximum per second

Offline Jaze

  • Newbie
  • Posts: 86
    • View Profile
Re: subscript out of range and suspicious non-appearance
« Reply #8 on: December 08, 2020, 03:44:16 pm »
I didn't write the relocateSarain sub yet. I wanted to get this first part correct. Thank you for pointing out the # tag, didn't know. I'll try to write the IF block as suggested. Maybe it will fix the ship not appearing until an arrow key is pushed. I still don't know why I was somethings getting a subscript out of range error. I think the code is good. Maybe I should allocate more windows 10 memory resources to QB64 but I can't seriously believe that it could be part of the problem.

Offline Jaze

  • Newbie
  • Posts: 86
    • View Profile
Re: subscript out of range and suspicious non-appearance
« Reply #9 on: December 08, 2020, 07:57:38 pm »
oh, and yeah. the bottom part will be the readout for damage for each ship. this battle scene is just part of a larger game. once i get the battle correct I'll either save all the elements in the originating program and chain it but i think cut and paste would be easier. i''l post the whole game when i'm finished

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: subscript out of range and suspicious non-appearance
« Reply #10 on: December 08, 2020, 08:04:16 pm »
You're writing this for QB64? in something other than old DOS OS?

If so, you don't need to chain and you don't need to reallocate resources.

To save a step I've already rewritten IF's for you, and removed CALL's this is QB64 not QBasic or old stuff.
I don't think I've gotten subscript error after rewrite. Two ships are now appearing, one you can move and the other sits there.
« Last Edit: December 08, 2020, 08:11:49 pm by bplus »