Posted: Sat Jul 26, 2008 4:38 pm
Oh, and Qb'll fuss at you if you try to read write past it's allocated space (default is 10). You have to dim the map to the proper size.
Discuss QBasic, Freebasic, QB64 and more
http://petesqbsite.com/phpBB3/
Code: Select all
screenres 640, 480, 8
'graphics images
dim grass as integer ptr = imageCreate(10, 10)
dim path as integer ptr = imageCreate(10, 10)
dim water as integer ptr = imageCreate(10, 10)
dim tent as integer ptr = imageCreate(10, 10)
dim scout as integer ptr = imageCreate(10, 10)
dim map(15, 30) as integer
'initialize variables
dim scoutX as integer = 5
dim scouty as integer = 1
dim clr as integer
dim x as integer
dim y as integer
dim key as string
dim vy as integer
dim vx as integer
'load grass tile
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
pset (x, y), clr
NEXT
NEXT
GET (1, 1)-(10, 10), grass
'load path tile
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
pset (x, y), clr
NEXT x
NEXT y
GET (1, 1)-(10, 10), path
'load water tile
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
pset (x, y), clr
NEXT x
NEXT y
GET (1, 1)-(10, 10), water
'load tent tile
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
pset (x, y), clr
NEXT x
NEXT y
GET (1, 1)-(10, 10), tent
'sprite
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
pset (x, y), clr
NEXT x
NEXT y
GET (1, 1)-(10, 10), scout
'load map
FOR y = 1 TO 15
FOR x = 1 TO 30
read clr
map(y, x) = clr
NEXT x
NEXT y
DO
'Prevent flicker
screenunlock
screenlock
cls
'keyboard input
key = INKEY$
vy = 0
vx = 0
'move
IF key = chr(255) + chr(72) THEN vy = -1
IF key = chr(255) + chr(80) THEN vy = 1
IF key = chr(255) + chr(75) THEN vx = -1
IF key = chr(255) + chr(77) THEN vx = 1
'Check against borders and water
if scoutX + vx > 0 and scoutX + vx <31> 0 and scoutY + vy < 16 then
if map(scouty + vy, scoutx + vx) <> 3 then
scoutX += vx
scouty += vy
end if
end if
end if
'draw map
FOR y = 1 TO 15
FOR x = 1 TO 30
IF map(y, x) = 1 THEN PUT (x * 10, y * 10), grass, PSET
IF map(y, x) = 2 THEN PUT (x * 10, y * 10), path, PSET
IF map(y, x) = 3 THEN PUT (x * 10, y * 10), water, PSET
IF map(y, x) = 4 THEN PUT (x * 10, y * 10), tent, PSET
NEXT x
NEXT y
'Draw the little dude
PUT (scoutX * 10, scoutY * 10), scout, trans
LOOP UNTIL multikey(1)
'release images
imageDestroy(grass)
imageDestroy(path)
imageDestroy(water)
imageDestroy(tent)
imageDestroy(scout)
end
'grass
DATA 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
DATA 2, 2,10, 2, 2, 2, 2, 2, 2, 2
DATA 2, 2, 2, 2, 2,10, 2, 2, 2, 2
DATA 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
DATA 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
DATA 2, 2, 2, 2, 2, 2,10, 2, 2, 2
DATA 2,10, 2, 2, 2, 2, 2, 2, 2, 2
DATA 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
DATA 2, 2, 2, 2, 2, 2, 2,10, 2, 2
DATA 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
'path
DATA 6,6,6,6,6,6,6,6,6,6
DATA 6,6,6,6,6,6,6,6,6,6
DATA 6,6,6,6,6,6,6,6,6,6
DATA 6,6,6,6,6,6,6,6,6,6
DATA 6,6,6,6,6,6,6,6,6,6
DATA 6,6,6,6,6,6,6,6,6,6
DATA 6,6,6,6,6,6,6,6,6,6
DATA 6,6,6,6,6,6,6,6,6,6
DATA 6,6,6,6,6,6,6,6,6,6
DATA 6,6,6,6,6,6,6,6,6,6
'water
DATA 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
DATA 11,11,11,11, 3, 3, 3, 3, 3, 3
DATA 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
DATA 3, 3, 3, 3, 3,11,11,11,11, 3
DATA 3, 3, 3, 3, 3, 3, 3, 3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,2,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,2,4,1,1,1,1,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,1,1,1,4,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,1,1,1,2,1,1,1,1,1,1,2,2,2,2,2,2,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,4,1,1,1,1,1,1,1,1,1,4,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3
DATA 2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
Code: Select all
'''Changes or additions by Ralph are identified with three apostrophes '''
DIM grass(10, 10), path(10, 10), water(10, 10), tent(10, 10), scout(10, 10), scoutmask(10, 10)
DIM oldscoutarea(10, 10), map(30, 15)'''
SCREEN 13
scoutx = 5
scouty = 1
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 1 THEN PSET (x, y), 10
IF clr = 0 THEN PSET (x, y), 2
NEXT
NEXT
GET (1, 1)-(10, 10), grass
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 0 THEN PSET (x, y), 6
IF clr = 1 THEN PSET (x, y), 14
NEXT
NEXT
GET (1, 1)-(10, 10), path
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 0 THEN PSET (x, y), 3
IF clr = 1 THEN PSET (x, y), 11
NEXT
NEXT
GET (1, 1)-(10, 10), water
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 0 THEN PSET (x, y), 6
IF clr = 1 THEN PSET (x, y), 8
IF clr = 2 THEN PSET (x, y), 0
NEXT
NEXT
GET (1, 1)-(10, 10), tent
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 0 THEN PSET (x, y), 0
IF clr = 1 THEN PSET (x, y), 5 '''was 2
IF clr = 2 THEN PSET (x, y), 8
IF clr = 3 THEN PSET (x, y), 14
IF clr = 4 THEN PSET (x, y), 4
NEXT
NEXT
GET (1, 1)-(10, 10), scout
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 0 THEN PSET (x, y), 255
IF clr = 1 THEN PSET (x, y), 2
IF clr = 2 THEN PSET (x, y), 8
IF clr = 3 THEN PSET (x, y), 14
IF clr = 4 THEN PSET (x, y), 4
NEXT
NEXT
GET (1, 1)-(10, 10), scoutmask
CLS
FOR y = 1 TO 15
FOR x = 1 TO 30
READ tilenumber
map(x, y) = tilenumber '''
IF tilenumber = 1 THEN PUT (x * 10, y * 10), grass, PSET
IF tilenumber = 2 THEN PUT (x * 10, y * 10), path, PSET
IF tilenumber = 3 THEN PUT (x * 10, y * 10), water, PSET
IF tilenumber = 4 THEN PUT (x * 10, y * 10), tent, PSET
NEXT
NEXT
'''Before PUTing the scout, GET the area where it will go
GET (scoutx * 10, scouty * 10)-(scoutx * 10 + 10, scouty * 10 + 10), oldscoutarea
PUT (scoutx * 10, scouty * 10), scoutmask, AND
PUT (scoutx * 10, scouty * 10), scout, OR
'''********************************************************************
DO
again1: '''
p$ = "": WHILE p$ = "": p$ = INKEY$: WEND '''
p$ = RIGHT$(p$, 1) '''
'''Check that an arrow key was pressed; if not, go to label again1:
IF p$ <> "H" AND p$ <> "K" AND p$ <> "M" AND p$ <> "P" THEN GOTO again1 '''
oldscoutx = scoutx
oldscouty = scouty
IF p$ = "H" AND scouty > 1 THEN scouty = scouty - 1
IF p$ = "K" AND scoutx > 1 THEN scoutx = scoutx - 1
IF p$ = "M" AND scoutx < 30 THEN scoutx = scoutx + 1
IF p$ = "P" AND scouty < 15 THEN scouty = scouty + 1
'''Check for water area in next jump; if water, don't allow jump
IF map(scoutx, scouty) = 3 THEN
scoutx = oldscoutx
scouty = oldscouty
GOTO again1
END IF
IF oldscoutx <> scoutx OR oldscouty <> scouty THEN
'''RESTORE tilenumber '''REMarked out
GOTO skip1 '''
'''Following code disabled by above GOTO
FOR y = 1 TO 15
FOR x = 1 TO 30
'READ tilenumber '''REMarked out by Ralph
tilenumber = map(x, y) '''new, by Ralph
IF tilenumber = 1 THEN PUT (x * 10, y * 10), grass, PSET
IF tilenumber = 2 THEN PUT (x * 10, y * 10), path, PSET
IF tilenumber = 3 THEN PUT (x * 10, y * 10), water, PSET
IF tilenumber = 4 THEN PUT (x * 10, y * 10), tent, PSET
NEXT
NEXT
skip1:
'''Restore oldscout's location with proper background
PUT (oldscoutx * 10, oldscouty * 10), oldscoutarea, PSET '''
'''GET the new scout location area
GET (scoutx * 10, scouty * 10)-(scoutx * 10 + 10, scouty * 10 + 10), oldscoutarea '''
PUT (scoutx * 10, scouty * 10), scoutmask, AND
PUT (scoutx * 10, scouty * 10), scout, OR
END IF
LOOP UNTIL p$ = CHR$(27)
'''********************************************************************
SYSTEM
grass:
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,1,0,0,0,0,0,0,0
DATA 0,0,0,0,0,1,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,1,0,0,0
DATA 0,1,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,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3,3,3
DATA 2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
Code: Select all
'''July 28, 2008: Changed GOTOs to DO/LOOPs
'''July 27, 2008: Changes or additions by Ralph are identified with three
'apostrophes, as in '''
DIM grass(10, 10), path(10, 10), water(10, 10), tent(10, 10), scout(10, 10), scoutmask(10, 10)
DIM oldscoutarea(10, 10), map(30, 15)'''
SCREEN 13
scoutx = 5
scouty = 1
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 1 THEN PSET (x, y), 10
IF clr = 0 THEN PSET (x, y), 2
NEXT
NEXT
GET (1, 1)-(10, 10), grass
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 0 THEN PSET (x, y), 6
IF clr = 1 THEN PSET (x, y), 14
NEXT
NEXT
GET (1, 1)-(10, 10), path
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 0 THEN PSET (x, y), 3
IF clr = 1 THEN PSET (x, y), 11
NEXT
NEXT
GET (1, 1)-(10, 10), water
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 0 THEN PSET (x, y), 6
IF clr = 1 THEN PSET (x, y), 8
IF clr = 2 THEN PSET (x, y), 0
NEXT
NEXT
GET (1, 1)-(10, 10), tent
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 0 THEN PSET (x, y), 0
IF clr = 1 THEN PSET (x, y), 5 '''was 2
IF clr = 2 THEN PSET (x, y), 8
IF clr = 3 THEN PSET (x, y), 14
IF clr = 4 THEN PSET (x, y), 4
NEXT
NEXT
GET (1, 1)-(10, 10), scout
FOR y = 1 TO 10
FOR x = 1 TO 10
READ clr
IF clr = 0 THEN PSET (x, y), 255
IF clr = 1 THEN PSET (x, y), 2
IF clr = 2 THEN PSET (x, y), 8
IF clr = 3 THEN PSET (x, y), 14
IF clr = 4 THEN PSET (x, y), 4
NEXT
NEXT
GET (1, 1)-(10, 10), scoutmask
CLS
FOR y = 1 TO 15
FOR x = 1 TO 30
READ tilenumber
map(x, y) = tilenumber '''
IF tilenumber = 1 THEN PUT (x * 10, y * 10), grass, PSET
IF tilenumber = 2 THEN PUT (x * 10, y * 10), path, PSET
IF tilenumber = 3 THEN PUT (x * 10, y * 10), water, PSET
IF tilenumber = 4 THEN PUT (x * 10, y * 10), tent, PSET
NEXT
NEXT
'''Before PUTing the scout, GET the area where it will go
GET (scoutx * 10, scouty * 10)-(scoutx * 10 + 10, scouty * 10 + 10), oldscoutarea
PUT (scoutx * 10, scouty * 10), scoutmask, AND
PUT (scoutx * 10, scouty * 10), scout, OR
'''********************************************************************
DO
DO '''Changed GOTOs to DO/LOOPs, on Mentat's good advice
DO '''Changed GOTOs to DO/LOOPs, on Mentat's good advice
p$ = "": WHILE p$ = "": p$ = INKEY$: WEND '''
p$ = RIGHT$(p$, 1) '''
LOOP UNTIL p$ = "H" OR p$ = "K" OR p$ = "M" OR p$ = "P" '''
oldscoutx = scoutx
oldscouty = scouty
IF p$ = "H" AND scouty > 1 THEN scouty = scouty - 1
IF p$ = "K" AND scoutx > 1 THEN scoutx = scoutx - 1
IF p$ = "M" AND scoutx < 30 THEN scoutx = scoutx + 1
IF p$ = "P" AND scouty < 15 THEN scouty = scouty + 1
'''Check for water area in next jump; if water, don't allow move
IF map(scoutx, scouty) = 3 THEN scoutx = oldscoutx: scouty = oldscouty
LOOP WHILE map(scoutx, scouty) = 3 '''
IF oldscoutx <> scoutx OR oldscouty <> scouty THEN
'''RESTORE tilenumber '''REMarked out
GOTO skip1 '''
'''Following code disabled by above GOTO
FOR y = 1 TO 15
FOR x = 1 TO 30
'READ tilenumber '''REMarked out by Ralph
tilenumber = map(x, y) '''new, by Ralph
IF tilenumber = 1 THEN PUT (x * 10, y * 10), grass, PSET
IF tilenumber = 2 THEN PUT (x * 10, y * 10), path, PSET
IF tilenumber = 3 THEN PUT (x * 10, y * 10), water, PSET
IF tilenumber = 4 THEN PUT (x * 10, y * 10), tent, PSET
NEXT
NEXT
skip1:
'''Restore oldscout's location with proper background
PUT (oldscoutx * 10, oldscouty * 10), oldscoutarea, PSET '''
'''GET the new scout location area
GET (scoutx * 10, scouty * 10)-(scoutx * 10 + 10, scouty * 10 + 10), oldscoutarea '''
PUT (scoutx * 10, scouty * 10), scoutmask, AND
PUT (scoutx * 10, scouty * 10), scout, OR
END IF
LOOP UNTIL p$ = CHR$(27)
'''********************************************************************
SYSTEM
grass:
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,1,0,0,0,0,0,0,0
DATA 0,0,0,0,0,1,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,1,0,0,0
DATA 0,1,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,1,0,0
DATA 0,0,0,0,0,0,0,0,0,0
path:
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
water:
DATA 0,0,0,0,0,0,0,0,0,0
DATA 1,1,1,1,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,1,1,1,1,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 1,1,1,1,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0
DATA 0,0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,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,2,4,1,1,1,1,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,1,1,1,4,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,1,1,1,2,1,1,1,1,1,1,2,2,2,2,2,2,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,4,1,1,1,1,1,1,1,1,1,4,1,1,1,1,3,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3,3
DATA 2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3
DATA 1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3
Oh, sorry. I was just talking to TmEE about the difference between do/loop and while/wend.Ralph wrote:Mentat, you already gave a very good reason NOT to use the GOTO. You are spoiling that by adding trivial reasons, as UNTIL can be substituted - and this is what I have used for years - with a WHILE/WEND. Just let your first, convincing reason why not to use GOTOs in public stand as THE reason, since most, if not all, other "reasons" can be stepped around by existing other coding commands, statements, or methods.