did you see the date on that? that was a month ago. I fixed everything now. i'm just trying to work on a pixel*tile scrolling engine. I can't really figure it out though... how would you draw one column/row of pixels at a time from a column/row of tiles?
you wanted code. here's my engine. but i'm really not working on that now. i postponed it for a text game. also note that i haven't worked on this for several weeks. and there will be some totally useless commands (i used my non-scrolling tile engine as a springboard
some code may be messy as well.
and it might be crude. i had to make this from scratch. no tutorials of any type. but i need help with pixel*tile scrolling.
DECLARE SUB encounter ()
DECLARE SUB WRITEtext ()
DECLARE SUB redrawbackground ()
DECLARE SUB redrawright ()
DECLARE SUB redrawup ()
DECLARE SUB redrawdown ()
DECLARE SUB reredraw ()
DECLARE SUB background ()
DECLARE SUB pressup ()
DECLARE SUB pressdown ()
DECLARE SUB pressleft ()
DECLARE SUB pressright ()
DECLARE SUB contactdown ()
DECLARE SUB contactright ()
DECLARE SUB contactleft ()
DECLARE SUB contact ()
DECLARE SUB redraw ()
DECLARE SUB ba0ckground ()
COMMON SHARED press, par AS INTEGER, one AS INTEGER, text$, lett AS INTEGER, word AS INTEGER, a AS INTEGER, b AS INTEGER, x3 AS INTEGER, y3 AS INTEGER, x AS INTEGER, y AS INTEGER, x1 AS INTEGER, y1 AS INTEGER, px%, py%, z%, z1%, ppx%, ppy%
'$DYNAMIC
DEFINT A-Z
SCREEN 13
x = 20
y = 20
DIM SHARED joey2%(201)
DIM SHARED visible(a, b)
DIM SHARED pal&(255)
DIM SHARED joey3%(201)
DIM SHARED map%(30, 30)
DIM SHARED grass%(201)
DIM SHARED ceiling%(201)
DIM SHARED waller%(201)
DIM SHARED wall%(201)
DIM SHARED tree%(201)
DIM SHARED c AS DOUBLE
DIM SHARED joeywalk%(201)
DIM SHARED joeymask%(201)
DIM SHARED tile%(20, 20)
DEF SEG = VARSEG(joey2%(0))
BLOAD "joey.pic", VARPTR(joey2%(0))
DEF SEG = VARSEG(joeymask%(0))
BLOAD "joeymask.pic", VARPTR(joeymask%(0))
DEF SEG = VARSEG(joeywalk%(0))
BLOAD "joeywalk.pic", VARPTR(joeywalk%(0))
DEF SEG = VARSEG(pal&(0))
BLOAD "pixit.pal", VARPTR(pal&(0))
FOR col% = 0 TO 255
OUT &H3C8, col%
OUT &H3C9, PEEK(VARPTR(pal&(col%)))
OUT &H3C9, PEEK(VARPTR(pal&(col%)) + 1)
OUT &H3C9, PEEK(VARPTR(pal&(col%)) + 2)
NEXT
DEF SEG
DEF SEG = &HA000
ppy% = 100
ppx% = 160
px% = 11
py% = 11
background
redrawbackground
PUT (ppx%, ppy%), joeymask%, AND
PUT (ppx%, ppy%), joey2%, OR
DO
DO
press$ = INKEY$
LOOP UNTIL press$ <> ""
SELECT CASE press$
CASE IS = CHR$(0) + CHR$(72)
pressup
encounter
CASE IS = CHR$(0) + CHR$(80)
pressdown
encounter
CASE IS = CHR$(0) + CHR$(75)
pressleft
encounter
CASE IS = CHR$(0) + CHR$(77)
pressright
encounter
CASE IS = CHR$(1)
END
CASE IS = CHR$(32)
text$ = "you look down. you see a shiny object! You bend over and find the"
WRITEtext
text$ = " Sword of the Gods! You wonder if it makes a good boomerang. You"
WRITEtext
text$ = "throw it with all your might. You watch as it soars away."
WRITEtext
END SELECT
'up is h
'down is p
'right is m
'left is k
DATA 3,3,3,3,3,3,1,2,1,1,2,2,2,2,2,2,2,2,2,2
DATA 3,6,6,6,6,3,1,2,1,1,2,2,2,2,2,2,2,2,2,2
DATA 3,4,4,4,4,3,1,2,1,1,2,2,2,2,2,2,2,2,2,2
DATA 3,4,4,4,4,3,1,2,1,1,2,2,2,2,2,2,2,2,2,2
DATA 3,4,4,4,4,3,1,2,1,1,2,2,2,2,2,2,2,2,2,2
DATA 3,3,4,3,3,3,1,2,1,1,2,2,2,2,2,2,2,2,2,2
DATA 6,6,4,6,6,6,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
LOOP UNTIL press$ = "q"
REM $STATIC
DEFSNG A-Z
SUB background
DEF SEG = VARSEG(tree%(0))
BLOAD "tree3.pic", VARPTR(tree%(0))
DEF SEG = VARSEG(waller%(0))
BLOAD "wall2.pic", VARPTR(waller%(0))
DEF SEG = VARSEG(ceiling%(0))
BLOAD "wall3.pic", VARPTR(ceiling%(0))
DEF SEG = VARSEG(grass%(0))
BLOAD "grass3.pic", VARPTR(grass%(0))
DEF SEG = VARSEG(wall%(0))
BLOAD "dunfloor.pic", VARPTR(wall%(0))
FOR y = 0 TO 19
FOR x = 0 TO 19
READ map%(x, y)
NEXT x
NEXT y
END SUB
SUB contact
x = ppx% / 20
y = ppy% / 20
too% = 20 - z%
y = y - 1
IF y = 0 THEN
py% = py% + 1
y = ppy%
END IF
IF map%(x, y) = 1 OR map%(x, y) = 3 OR map%(x, y) = 6 THEN
z% = 0
END IF
IF py% = 0 THEN
py% = py% + 1
END IF
END SUB
SUB contactdown
x = px%
y = py%
y = y + 1
IF map%(x, y) = 1 OR map%(x, y) = 3 OR map%(x, y) = 6 OR y = 10 OR y = 0 THEN
z% = 0
END IF
END SUB
SUB contactleft
x = px%
y = py%
x = x + 1
IF map%(x, y) = 1 OR map%(x, y) = 3 OR map%(x, y) = 6 THEN
z1% = 0
END IF
END SUB
SUB contactright
x = px%
y = py%
x = x - 1
IF map%(x, y) = 1 OR map%(x, y) = 3 OR map%(x, y) = 6 THEN
z1% = 0
END IF
END SUB
DEFINT A-Z
SUB encounter
RANDOMIZE TIMER
enc% = INT(RND * 10)
IF enc% = 4 THEN
PRINT "hi!!!!!"
END IF
END SUB
DEFSNG A-Z
SUB pressdown
z% = 0
redrawbackground
contactdown
py% = py% + 1
redrawbackground
PUT (ppx%, ppy%), joeymask%, AND
PUT (ppx%, ppy%), joey2%, XOR
WAIT &H3DA, 8
WAIT &H3DA, 8, 8
END SUB
SUB pressleft
redrawbackground
contactright
px% = px% - 1
redrawbackground
PUT (ppx%, ppy%), joeymask%, AND
PUT (ppx%, ppy%), joey2%, XOR
WAIT &H3DA, 8
WAIT &H3DA, 8, 8
FOR c = 1 TO 500
NEXT c
END SUB
SUB pressright
redrawbackground
contactleft
px% = px% + 1
redrawbackground
PUT (ppx%, ppy%), joeymask%, AND
PUT (ppx%, ppy%), joey2%, XOR
WAIT &H3DA, 8
WAIT &H3DA, 8, 8
FOR c = 1 TO 500
NEXT c
END SUB
SUB pressup
redrawbackground
contact
py% = py% - 1
redrawbackground
PUT (ppx%, ppy%), joeymask%, AND
PUT (ppx%, ppy%), joey2%, XOR
WAIT &H3DA, 8
WAIT &H3DA, 8, 8
FOR c = 1 TO 500
NEXT c
END SUB
SUB redraw
y = py%
x = px%
IF map%(x, y) = 1 THEN
PUT (x * 20, y * 20), tree%, PSET
ELSEIF map%(x, y) = 2 THEN
PUT (x * 20, y * 20), grass%, PSET
ELSEIF map%(x, y) = 3 THEN
PUT (x * 20, y * 20), ceiling%, PSET
ELSEIF map%(x, y) = 4 THEN
PUT (x * 20, y * 20), wall%, PSET
ELSEIF map%(x, y) = 6 THEN
PUT (x * 20, y * 20), waller%, PSET
END IF
END SUB
DEFINT A-Z
SUB redrawbackground
qwe% = ppx%
qew% = ppy%
FOR y = -5 TO 4
FOR x = -8 TO 7
'x should be 160, y should be 100.
x1 = qwe% + (x * 20)
y1 = qew% + (y * 20)
tile% = map%(px% + x, py% + y)
IF tile% = 1 THEN
PUT (x1, y1), tree%, PSET
ELSEIF tile% = 2 THEN
PUT (x1, y1), grass%, PSET
ELSEIF tile% = 3 THEN
PUT (x1, y1), ceiling%, PSET
ELSEIF tile% = 4 THEN
PUT (x1, y1), wall%, PSET
ELSEIF tile% = 6 THEN
PUT (x1, y1), waller%, PSET
END IF
NEXT x
NEXT y
END SUB
SUB redrawdown
SELECT CASE press
CASE press = 80
y = y + 1
END SELECT
IF map%(x, y) = 1 THEN
PUT (x * 20, y * 20), tree%, PSET
ELSEIF map%(x, y) = 2 THEN
PUT (x * 20, y * 20), grass%, PSET
ELSEIF map%(x, y) = 3 THEN
PUT (x * 20, y * 20), ceiling%, PSET
ELSEIF map%(x, y) = 4 THEN
PUT (x * 20, y * 20), wall%, PSET
ELSEIF map%(x, y) = 6 THEN
PUT (x * 20, y * 20), waller%, PSET
END IF
END SUB
SUB redrawleft
END SUB
SUB redrawright
SELECT CASE press
CASE press = 77
x = x + 1
END SELECT
IF map%(x, y) = 1 THEN
PUT (x * 20, y * 20), tree%, PSET
ELSEIF map%(x, y) = 2 THEN
PUT (x * 20, y * 20), grass%, PSET
ELSEIF map%(x, y) = 3 THEN
PUT (x * 20, y * 20), ceiling%, PSET
ELSEIF map%(x, y) = 4 THEN
PUT (x * 20, y * 20), wall%, PSET
ELSEIF map%(x, y) = 6 THEN
PUT (x * 20, y * 20), waller%, PSET
END IF
END SUB
SUB redrawup
SELECT CASE press
CASE press = 72
x = px%
y = py%
y = y - 1
END SELECT
IF map%(x, y) = 1 THEN
PUT (x * 20, y * 20), tree%, PSET
ELSEIF map%(x, y) = 2 THEN
PUT (x * 20, y * 20), grass%, PSET
ELSEIF map%(x, y) = 3 THEN
PUT (x * 20, y * 20), ceiling%, PSET
ELSEIF map%(x, y) = 4 THEN
PUT (x * 20, y * 20), wall%, PSET
ELSEIF map%(x, y) = 6 THEN
PUT (x * 20, y * 20), waller%, PSET
END IF
END SUB
SUB reredraw
x = px%
y = py%
SELECT CASE press
CASE press = 75
x = x - 1
END SELECT
IF map%(x, y) = 1 THEN
PUT (x * 20, y * 20), tree%, PSET
ELSEIF map%(x, y) = 2 THEN
PUT (x * 20, y * 20), grass%, PSET
ELSEIF map%(x, y) = 3 THEN
PUT (x * 20, y * 20), ceiling%, PSET
ELSEIF map%(x, y) = 4 THEN
PUT (x * 20, y * 20), wall%, PSET
ELSEIF map%(x, y) = 6 THEN
PUT (x * 20, y * 20), waller%, PSET
END IF
END SUB
SUB WRITEtext
LINE (0, 0)-(319, 24), 0, BF
lett = LEN(text$)
word = 0
par = 0
one = 1
DO
FOR typing% = 1 TO 3000
NEXT typing%
word = word + 1
par = par + 1
IF par = 40 THEN one = one + 1
text$ = RIGHT$(text$, lett - word + 1)
par = 1
word = 1
lett = LEN(text$)
worda$ = LEFT$(text$, word)
COLOR 15
LOCATE one, 1
PRINT worda$
LOOP UNTIL word = lett
DO
LOOP UNTIL INKEY$ <> ""
LINE (0, 0)-(319, 24), 0, BF
END SUB