Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
P*P scroller. No libs no Call absolute.
#11
:evil: argh... going through over 50 kb's of code to find one command...

okay, found it. running it...

hm, not bad. 120 to 130 fps. grr... thought it'd run faster... oh well.


ran a really slow pixel scroller with no wait &h3da, 8 though. went from 19 fps to 150! now i'm gonna try it with other scrollers. thanks!
Jumping Jahoolipers!
Reply
#12
Just Cut and paste the above code since I remmed the AF. Prints there. AF.Print=Sloooooooooooowwwwww. ;*)


The first post is the above code.
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#13
i already found it. i got 109-140 fps. not bad. but dig this: a scroller that uses part of the screen does around 70 fps with wait. I take wait out, and it skyrockets to 1000 fps!!! but i dunno if it actually was 1000 fps... it wasn't scrolling any faster...but what do i know?
Jumping Jahoolipers!
Reply
#14
What scroller?
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#15
aaron severn's pixel scroller it only uses part of the screen though.
Jumping Jahoolipers!
Reply
#16
the thing is. it aint as useful as the zelda scroller. I could give you a faster one if you want. ;*)

Would run at 22 FPS on a 486, 2 layers, animated tiles and tile*tile collision detection. ;*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#17
no, it isn't as useful. but here's a nice zelda-type scroller. No layers though.

Code:
DECLARE SUB drawscreen ()
DECLARE SUB clrkbuffer ()
'$DYNAMIC

DIM SHARED stp AS INTEGER
IF COMMAND$ <> "" THEN
    stp = VAL(COMMAND$)
ELSE
    stp = 1
END IF

DIM SHARED map(0, 0) AS INTEGER
DIM SHARED tiles(0, 0) AS INTEGER
DIM SHARED sprites(0, 0) AS INTEGER

SCREEN 13
DEFINT A-Z

DIM SHARED x, y AS INTEGER          'location
DIM SHARED xcam, ycam AS INTEGER    'camera location
DIM SHARED xsize, ysize AS INTEGER  'size of screen
DIM SHARED xmap, ymap AS INTEGER    'size of map (tiles)
DIM SHARED xmap2, ymap2 AS INTEGER  'size of map (pixels)


FOR a = 0 TO 15
    LINE (0, a)-(15, a), a
    LINE (a + 16, 0)-(a + 16, 15), a
NEXT

REDIM tiles(129, 1) AS INTEGER
GET (0, 0)-(15, 15), tiles(0, 0)
GET (16, 0)-(31, 15), tiles(0, 1)

CLS
'LINE (0, 0)-(15, 15), 15
'LINE (0, 15)-(15, 0), 15
CIRCLE (7, 7), 7, 15
PAINT (7, 7), 15
CIRCLE (7, 7), 3, 0
PAINT (7, 7), 0
REDIM sprites(129, 0) AS INTEGER
GET (0, 0)-(15, 15), sprites(0, 0)

READ xmap, ymap
REDIM map(ymap, xmap) AS INTEGER
FOR ym = 0 TO ymap
    FOR xm = 0 TO xmap
        READ map(ym, xm)
    NEXT
NEXT
xmap2 = 16 * xmap + 15
ymap2 = 16 * ymap + 15

x = 0
y = 0
xcam = 0
ycam = 0


CLS

'drawscreen
DIM SHARED f AS INTEGER
f = 0
stime# = TIMER
DO
    drawscreen
    a = INP(&H60)
    clrkbuffer
    IF a = 1 THEN EXIT DO
    IF a = 72 AND y > 0 THEN
        FOR dy = 0 TO 15 STEP stp
            y = y - stp
            IF y < ycam + 50 AND ycam > 0 THEN ycam = ycam - stp
            drawscreen
        NEXT
    END IF
    IF a = 80 AND y + 15 < ymap2 THEN
        FOR dy = 0 TO 15 STEP stp
            y = y + stp
            IF y > ycam + 134 AND ycam + 199 < ymap2 THEN ycam = ycam + stp
            drawscreen
        NEXT
    END IF
    IF a = 75 AND x > 0 THEN
        FOR dx = 0 TO 15 STEP stp
            x = x - stp
            IF x < xcam + 50 AND xcam > 0 THEN xcam = xcam - stp
            drawscreen
        NEXT
    END IF
    IF a = 77 AND x + 15 < xmap2 THEN
        FOR dx = 0 TO 15 STEP stp
            x = x + stp
            IF x > xcam + 254 AND xcam + 319 < xmap2 THEN xcam = xcam + stp
            drawscreen
        NEXT
    END IF
LOOP
PRINT f / (TIMER - stime#)
DO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,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
DATA 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1
DATA 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0
DATA 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1

REM $STATIC
SUB clip (realx, realy, x1, y1, x2, y2, segment, offset)

p1& = offset + 16 * y1 + 4
p2& = 320& * realy + realx - x1
FOR yc = y1 TO y2
    FOR xc = x1 TO x2
        DEF SEG = segment
        colour = PEEK(p1& + xc)
        DEF SEG = &HA000
        POKE p2& + xc, colour
    NEXT xc
    p1& = p1& + 16
    p2& = p2& + 320
NEXT yc

END SUB

SUB clrkbuffer

DEF SEG = &H40
POKE &H1A, PEEK(&H1C)

END SUB

SUB drawscreen

f = f + 1
xspr = x - xcam
yspr = y - ycam

p& = 0
yscreen = 0
DO
    ysmap = yscreen + ycam
    ymod = ysmap MOD 16
    ytile = ysmap \ 16
    xscreen = 0
    DO
        xsmap = xscreen + xcam
        xmod = xsmap MOD 16
        xtile = xsmap \ 16
        tile = map(ytile, xtile)
        IF xmod = 0 AND ymod = 0 AND xscreen < 304 AND yscreen < 176 THEN
            PUT (xscreen, yscreen), tiles(0, tile), PSET
        ELSE
            IF xscreen < 304 THEN x2 = 15 ELSE x2 = 319 - xscreen
            IF yscreen < 176 THEN y2 = 15 ELSE y2 = 191 - yscreen
            segment = VARSEG(tiles(0, tile))
            p1& = VARPTR(tiles(0, tile)) + 16 * ymod + 4
            p2& = 320& * yscreen + xscreen - xmod
            FOR yc = ymod TO y2
                FOR xc = xmod TO x2
                    DEF SEG = segment
                    colour = PEEK(p1& + xc)
                    DEF SEG = &HA000
                    POKE p2& + xc, colour
                NEXT xc
                p1& = p1& + 16
                p2& = p2& + 320
            NEXT yc
        END IF
        IF xscreen >= xspr AND xscreen < xspr + 16 AND yscreen >= yspr AND yscreen < yspr + 16 THEN
            segment = VARSEG(sprites(0, 0))
            p1& = VARPTR(sprites(0, 0)) + 16 * ymod + 4
            p2& = 320& * yspr + xspr - xmod
            FOR yc = 0 TO 15
                FOR xc = 0 TO 15
                    DEF SEG = segment
                    colour = PEEK(p1& + xc)
                    IF colour THEN
                        DEF SEG = &HA000
                        POKE p2& + xc, colour
                    END IF
                NEXT xc
                p1& = p1& + 16
                p2& = p2& + 320
            NEXT yc
        END IF
        xscreen = xscreen + 16 - xmod
    LOOP UNTIL xscreen > 319
    yscreen = yscreen + 16 - ymod
LOOP UNTIL yscreen > 191

END SUB

SUB myput (x1, y1, tilenum)

IF x1 > -1 AND y1 > -1 AND x1 < 304 AND y1 < 184 THEN
    PUT (x1, y1), tiles(0, tilenum), PSET
ELSE
    segment = VARSEG(tiles(2, tilenum))
    offset = VARPTR(tiles(2, tilenum))
    DEF SEG = segment
    FOR yc = 0 TO 15
        IF yc + y1 > -1 AND yc + y1 < 200 THEN
            FOR xc = 0 TO 15
                IF xc + x1 > -1 AND xc + x1 < 320 THEN
                    DEF SEG = segment
                    colour = PEEK(offset + xc + 16 * yc)
                    DEF SEG = &HA000
                    POKE xc + x1 + 320& * (yc + y1), colour
                END IF
            NEXT xc
        END IF
    NEXT yc
END IF

END SUB

good pixel scrollers are slightly more abundant then I originally thought. this one is fairly good, and unlike the other ones in the archive, this one actually has you controlling a sprite.
Jumping Jahoolipers!
Reply
#18
The above post controls a sprite. Plus a tile*tile collision. What could you ask for more. It has lots of comments and stuff.

In the meantime....

http://www.qbrpgs.com/files/RelGFX.zip

This is still pure QB. ;*)

Look at the clipping algo in Rel.Sprite. ;*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#19
yeah. the above engine is nice. The only thing i don't really like is that it's so big Sad it's hard to go through. But yeah, it'd be quite easy to convert to an rpg engine. It'd defenaitley make a good weekend read.
Jumping Jahoolipers!
Reply
#20
Yeah, I usually put a lot of comment in the code since not putting any or even limiting the comments would defeat the purpose of a learning material. ;*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)