Qbasicnews.com

Full Version: Best platform game engines?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi, can anybody please tell me, where can I find the best platform game engines for qbasic that uses pixel by pixel scrolling. I hope this won't be using any libraries.
er...if you're going to use a pre-built engine, you're essentially using a "library" anyway. That said, I don't know of any "engines" intended for other programmers to use...although there are a few games with level editors (SonicX and Keen 7, iirc).
OK, But does anyone have other suggestens?
I'm not really into this stuff...but can't you just PUT sprites as background and then do something like this:

http://www.qbasicnews.com/articles.php?id=19

At least that's how I'm doing it with my Pacman game (top-view, but that shouldn't matter...)
This is pixel*pixel scrolling is pritty slow. I know this meant to explian how it works. Anyway this isn't my point.
Some time ago I found this program:
'Zelda type scrolling tutorial by Richard Eric M. Lope aka Relsoft' that was made in April 9 2003.. with no libs there!!!
and it is really good. I wonder if it the best for platform games out there even if it designed for RPG games?
That scrolling engine could easily be converted into a platform engine. :*)

Just make a jumping algo, a tile*tile collision, add gravity and friction and update the screen using the update camera sub then draw. That's it a simple yet fast platform engine. :*)


Here's a platform engine made by Nathan. With a lil modification, it could be converted into a scroller. :*)


Code:
PRINT "========"
PRINT "GRAVITY!"
PRINT "========"
PRINT "(My first test with a gravity engine)"
PRINT
PRINT
PRINT "Hints:"
PRINT "  * Use o <-, p -> & space (jump)."
PRINT "  * It uses 320x200x16."
PRINT

SLEEP: k$ = INKEY$
SCREEN 7, , 0, 0 ' EGA (320x200x16 x 256Kcolour)

' Draw en GET sprite

DIM Sprite%(65)
CIRCLE (8, 8), 7, 13
PAINT (8, 8), 5, 13
GET (0, 0)-(15, 15), Sprite%(0)

' This read some DATAs to draw the screen with nice tiles

DIM Scr%(19, 11)
FOR y% = 0 TO 11
   FOR x% = 0 TO 19
      READ tile%
      Scr%(x%, y%) = tile%
      SELECT CASE tile%
         CASE 0:
            LINE (x% * 16, y% * 16)-(x% * 16 + 15, y% * 16 + 15), 1, BF' Nada
         CASE 1:
            LINE (x% * 16, y% * 16)-(x% * 16 + 15, y% * 16 + 15), 14, BF' Ladrillito
            LINE (x% * 16, y% * 16)-(x% * 16 + 15, y% * 16), 6
            LINE (x% * 16, y% * 16 + 8)-(x% * 16 + 15, y% * 16 + 8), 6
            LINE (x% * 16 + 8, y% * 16)-(x% * 16 + 8, y% * 16 + 8), 6
            LINE (x% * 16, y% * 16 + 8)-(x% * 16, y% * 16 + 15), 6
         CASE 2:
            LINE (x% * 16, y% * 16)-(x% * 16 + 15, y% * 16 + 15), 2, BF
            LINE (x% * 16, y% * 16)-(x% * 16 + 15, y% * 16 + 15), 12
            LINE (x% * 16 + 15, y% * 16)-(x% * 16, y% * 16 + 15), 12
            LINE (x% * 16, y% * 16)-(x% * 16 + 15, y% * 16 + 15), 10, B
         CASE 3:
            LINE (x% * 16, y% * 16)-(x% * 16 + 15, y% * 16 + 15), 11, BF
            LINE (x% * 16, y% * 16)-(x% * 16 + 15, y% * 16 + 15), 3, B
            CIRCLE (x% * 16 + 8, y% * 16 + 8), 7, 9
            PAINT (x% * 16 + 8, y% * 16 + 8), 1, 9
      END SELECT
   NEXT
NEXT

' No buffering, lotsa flicker, but I don't give a damn ;)

x% = 16000
y% = 0
cx% = x%: cy% = y%
vy% = 0
g% = 9
d% = 0

' Begin

terminado% = 0

WHILE NOT terminado%
   ' Gravity: We accelerate our ball
   vy% = vy% + g%
   ' Collision... Should we stop the ball?
   ' We just look if there's a tile in the supposed next position of
   ' our ball.
   ' If there is, I adjust the ball to a correct position (so it doesn't
   ' collide with the tile), and I make it bounce using d%\30
    
   ' Bounce on floor
   ' ===============
   IF vy% > 0 THEN
      IF x% MOD 1600 = 0 THEN
         IF Scr%(x% \ 1600, 1 + (y% + vy%) \ 1600) <> 0 THEN
            y% = ((y% + vy%) \ 1600) * 1600' Esto ajusta al borde superior de la 'casilla'.
            vy% = -d% \ 30
            d% = 0
         END IF
      ELSE
         IF Scr%(x% \ 1600, 1 + (y% + vy%) \ 1600) <> 0 OR Scr%(1 + x% \ 1600, 1 + (y% + vy%) \ 1600) <> 0 THEN
            y% = ((y% + vy%) \ 1600) * 1600' Esto ajusta al borde superior de la 'casilla'.
            vy% = -d% \ 30
            d% = 0
         END IF
     END IF

   ' Bounce on ceilings
   ' ==================
   ELSEIF vy% < 0 THEN
      IF x% MOD 1600 = 0 THEN
         IF Scr%(x% \ 1600, (y% + vy%) \ 1600) <> 0 THEN
            y% = (1 + (y% + vy%) \ 1600) * 1600' Esto ajusta al borde superior de la 'casilla'.
            vy% = d% \ 30
            d% = 0
         END IF
      ELSE
         IF Scr%(x% \ 1600, (y% + vy%) \ 1600) <> 0 OR Scr%(1 + x% \ 1600, (y% + vy%) \ 1600) <> 0 THEN
            y% = (1 + (y% + vy%) \ 1600) * 1600' Esto ajusta al borde superior de la 'casilla'.
            vy% = d% \ 30
            d% = 0
         END IF
      END IF
   END IF
   ' Draw
   rx% = x% \ 100: ry% = y% \ 100
   rcx% = cx% \ 100: rcy% = cy% \ 100
   LINE (rcx%, rcy%)-(rcx% + 15, rcy% + 15), 1, BF
   PUT (rx%, ry%), Sprite%, OR
   cx% = x%: cy% = y%
   ' Move ball vertically:
   y% = y% + vy%: IF y% < 0 THEN y% = 0: vy% = 0' Para los saltos salvajes.
   d% = d% + ABS(vy%)
   LOCATE 25, 1: PRINT USING "x:### y:### vy:#### d:###"; x% \ 100; y% \ 100; vy% \ 100; d% \ 100;
   ' This is just for bounces. In a platform game it is not used. It is just
   ' a variable that stores the height from where the ball falls to calculate
   ' the bouncing speed:
  
   IF vy% < 7 AND vy% > -7 THEN d% = 0
  
   ' Sync
   WAIT &H3DA, 8
   WAIT &H3DA, 8, 8
  
   ' Keyboard
   k% = INP(&H60)
   SELECT CASE k%
      CASE 1
         terminado% = NOT terminado%
      CASE 24
         ' Let's check if we can move
         puedo% = NOT 0
         IF x% = 0 THEN puedo% = 0
         IF x% MOD 1600 = 0 THEN       ' Tile border
            IF y% MOD 1600 = 0 THEN    ' I just look at the tile to the left
               IF Scr%((x% \ 1600) - 1, y% \ 1600) <> 0 THEN puedo% = 0
            ELSE                       ' I look two tiles:x-1,y and x-1,y+1
               IF Scr%((x% \ 1600) - 1, y% \ 1600) <> 0 OR Scr%((x% \ 1600) - 1, (y% \ 1600) + 1) <> 0 THEN puedo% = 0
            END IF
         END IF
         IF puedo% THEN
            x% = x% - 100
         END IF
    
      CASE 25
         ' Vemos si podemos mover
         puedo% = NOT 0
         IF x% = 30400 THEN puedo% = 0
         IF x% MOD 1600 = 0 THEN
            IF y% MOD 1600 = 0 THEN
               IF Scr%((x% \ 1600) + 1, y% \ 1600) <> 0 THEN puedo% = 0
            ELSE
               IF Scr%((x% \ 1600) + 1, y% \ 1600) <> 0 OR Scr%((x% \ 1600) + 1, (y% \ 1600) + 1) <> 0 THEN puedo% = 0
            END IF
         END IF
         IF puedo% THEN
            x% = x% + 100
         END IF
      CASE 57
         ' Vemos si salto o no:
         IF x% MOD 1600 = 0 THEN
            IF Scr%(x% \ 1600, 1 + (y% + vy%) \ 1600) <> 0 THEN
               '?((y%+vy%)\1600)*1600
               y% = ((y% + vy%) \ 1600) * 1600 ' Adjust to upper bound of our tile
               vy% = -500
               d% = 0
            END IF
         ELSE
            IF Scr%(x% \ 1600, 1 + (y% + vy%) \ 1600) <> 0 OR Scr%(1 + x% \ 1600, 1 + (y% + vy%) \ 1600) <> 0 THEN
               y% = ((y% + vy%) \ 1600) * 1600
               vy% = -500
               d% = 0
            END IF
         END IF
   END SELECT
   ' Clear buffer
   k$ = INKEY$
WEND

SCREEN 0, 0, 0, 0: WIDTH 80, 25

' Map:

DATA 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DATA 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DATA 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2
DATA 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DATA 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 2
DATA 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 1, 0, 0, 0, 1, 2
DATA 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2
DATA 2, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 1
DATA 1, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2
DATA 1, 0, 0, 3, 2, 1, 2, 0, 2, 2, 0, 0, 3, 0, 0, 3, 3, 0, 2, 1
DATA 1, 0, 0, 3, 1, 2, 3, 0, 2, 2, 0, 0, 3, 0, 0, 3, 3, 0, 2, 2
DATA 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1

' Jua jua :) bebe konga.
thanks relsoft, for clearing it up to me, and for others who tried to help. Smile
I coded that? When? :o Big Grin

Gosh I don't even remember what I code Tongue though the "Bebe Konga" at the very end is a definitive clue.
so what does "Jua jua Smile bebe konga." mean anyway?
Try babelfish, I just want to have a laugh before i tell you what it really means.
Pages: 1 2