The engine doen't look good, but look beneath that and look at the possibilities. I will add a texture soon and a landscape instead of just black and blue dots.
Here is my monchronome map scroller. I doesn't work with tiles, but with 2 colour pixels. This example may suck because I haven't made a map editor yet. Probably I will make one soon in screen 12. Anyway, it is scrolling a map that is 8 times larger then the screen. The pixels are just random and that looks shitty, but imagine how nice it could be if the pixels are placed in some kind of landscape.
This engine can be used with tiles also, so that you can see only the coloured pixels on the map, so textures actually are supported.
I think I will release a demo soon that uses this with a texture and with a landscape. But I first have to make the map editor.
This may going to be used in a worms-like engine. I wrote an article on that(in the QBE that is not out yet), where this technique is described. I did some optimization though.
Well, I'll give you the code:
Code: Select all
REM Scroll.bas REM ______________________________ REM Testcase for monochrome engine REM Can scroll a map with monchronome pixels REM The map can be up to 8 times the screen REM But only supports two color(back and foreground) REM Made by Codemss REM REM May be used for learning purposes REM But if you copy ANY of this code REM I want credit REM REM Greets, REM Codemss REM ______________________________ REM BTW REM I wrote a article about this for the QBE REM (QBasic Express), but it has not yet came out REM REM I will send a new version with this code included to Pete REM I am very happy because in the article I doubted if it was REM possible to use this technique at high speed REM but I got 100 fps on a pentium 4. REM So I think it is fast enough REM ______________________________ DECLARE SUB drawrow (x%, y%) DECLARE FUNCTION getpix% (x%, y%) CLS SCREEN 13 DEFINT A-Z REM $DYNAMIC REM IMPORTANT: IF YOU WANT TO COMPILE, MAKE THESE INTEGERS!! REM THIS IS FASTER AND ELSE IT PROBABLY WONT WORK REM DO NOT MAKE THE WHOLE LINE A COMMENT AS THE VARIABLES REM STILL NEED TO BE SHARED! DIM SHARED p AS LONG DIM SHARED offset AS LONG DIM SHARED mul320(319) AS LONG CONST xsize = 320 * 8 - 1 DIM SHARED buf(31999), bufseg bufseg = VARSEG(buf(0)) DIM SHARED ntb(255, 7) FOR n = 0 TO 255 FOR b = 0 TO 7 IF (n AND (2 ^ b)) THEN ntb(n, b) = 1 NEXT NEXT DIM SHARED lut(319) DIM SHARED bitnum(xsize) DIM SHARED bytenum(xsize) FOR x = 0 TO xsize bitnum(x) = x AND 7 bytenum(x) = x \ 8 NEXT FOR y = 0 TO 319 mul320(y) = 320& * y NEXT DEF SEG = bufseg FOR y = 0 TO 199 FOR x = 0 TO 319 POKE p, INT(RND * 256) p = p + 1 NEXT NEXT t1! = TIMER DO UNTIL LEN(INKEY$) p = 0 FOR y = 0 TO 199 drawrow a, y NEXT a = a + 1 IF a > xsize - 319 THEN EXIT DO LOOP t2! = TIMER PRINT a / (t2! - t1!) DEF SEG SLEEP REM $STATIC SUB drawrow (x, y) offset = bytenum(x) + mul320(y) bit = bitnum(x) xx = 0 DO value = PEEK(offset) FOR b = bit TO 7 lut(xx) = ntb(value, b) IF xx = 319 THEN EXIT DO xx = xx + 1 NEXT bit = 0 offset = offset + 1 LOOP DEF SEG = &HA000 FOR xx = 0 TO 319 POKE p, lut(xx) p = p + 1 NEXT DEF SEG = bufseg END SUB