# Super Low Res Game Challenge

May 12 2010 at 8:13 PM
R

So as my last few challenges have met limited to no interest,i got to thiking, and inspired by a hack a day project i saw i came up with a challenge i think should appeal to many, and hopefully we will see some really cool games come out of it.

So, my challenge, should you choose to accept...is....
Make a game using only this LED style matrix as your display. Any type of game is fine, i am going for a simple jumping side scroller, If you want to use a matrix that has a differant layout or resolution(mine is 40*20 !!! LOL) then please feel free...

Here is the code for the matrix.....thanks folks..UNSEEN

DECLARE SUB blankmatrix ()

CALL blankmatrix

SUB blankmatrix

CLS
SCREEN 12

DIM cx AS INTEGER, cy AS INTEGER, cnt AS INTEGER

cx = 25: cy = 80

DO

CIRCLE (cx, cy), 7, 8

cx = cx + 15

cnt = cnt + 1

IF cnt MOD 40 = 0 THEN

cy = cy + 15
cx = 25

END IF

LOOP UNTIL cnt = 800

END SUB

 Respond to this message
Unseen Machine
R

# SLR GAME 1 - 4 Level Playable Demo

May 13 2010, 6:48 PM

I thought that i might inspire some poeple with my challenge, but it seems not to have had quite the impact i was expecting and hoping for ( maybe i need to be more patient?). Nether the less, i have continued with my project and have now completed 4 levels.

Simple levels can be made by creating new data blocks, bridges and elevators however are more difficult to code.

I am going to leave this project alone now and start work on a level creator, which will write the full code for level's and the main programme. This could take sometime to get things like multiple bridges and enemies sorted but one stage at a time. Expect to see v.01 sometime this week....

You play a blue jumping blob...

Though it has a few nigling little problems, the levels are fully playable, get to the red X to go to the next level.

Arrow keys control movement (Up = Jump - left/right move and enter skips levels!!), it is far from finished so please let me know how you think i can improve it or any ideas for what you would like in the game.

On the last level, sometimes when jumping on the bridge, you fall through it!!!! I am trying to figure out how to fix this, but if anyone has any ideas please let me know as this is something i am having great trouble with. ..thanks folks...UNSEEN

updated CODE >>>>>>>>>>>>>>>>>>>>>>>>>>

'Qb jump version .01 - By Unseen Machine

DECLARE SUB level3 ()
DECLARE SUB level2 ()
DECLARE SUB loose ()
DECLARE SUB startgame ()

DIM SHARED level AS INTEGER
DIM SHARED bstart1 AS INTEGER, bstart2 AS INTEGER
DIM SHARED bcnt AS INTEGER, grav AS SINGLE
DIM SHARED px AS INTEGER, py AS INTEGER, bflag AS INTEGER

grav = .08

bstart1 = 160
bstart2 = 335

DO

CALL startgame
level = level + 1
bcnt = 1

LOOP UNTIL level = 4

'level data

DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,4,9,9,9,4,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,4,9,4,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,4,9,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,4,9,4,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,4,9,9,9,4,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,2,2,2,2,2,2,2,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,2,2,2,2,9,9,9,6,6,6,6,6,6,6,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,6,6,6,9,9,9,9,9,9,9,9,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,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6,6,9,8,8,9,9,9,9,9,9,9,9,9,9,2,2,2,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,6,9,9,8,8,9,9,9,9,9,9,9,9,9,9,6,6,6,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,2,9,9,9,9,9,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,2,9,9,9,9,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9
DATA 9,9,9,9,9,9,9,9,9,9,9,9,9,9,6,6,9,9,9,9,8,8,9,9,9,9,2,9,9,9,9,9,9,9,9,9,9,9,9,9
DATA 9,2,9,2,2,2,2,2,2,9,9,9,9,9,6,6,9,9,9,9,8,8,9,9,9,9,6,9,9,9,9,9,9,9,9,9,9,9,9,9
DATA 9,9,2,6,6,6,6,6,6,2,2,2,2,2,6,6,9,9,9,2,8,8,9,9,9,9,6,9,9,2,2,2,9,9,9,9,9,9,9,9
DATA 9,2,6,6,6,6,6,6,6,6,6,6,6,6,6,6,9,9,9,6,8,8,9,9,9,9,6,9,9,6,6,6,9,9,9,9,9,9,9,9

SUB level2

'bridge one animation

IF bcnt <= 13 THEN

CIRCLE (bstart1, 350), 7, 9

ELSEIF bcnt > 13 THEN

CIRCLE (bstart1 + 15, 350), 7, 9

END IF

PAINT STEP(0, 0), 0, 9

FOR i = 1 TO 4 STEP 1

CIRCLE STEP(15, 0), 7, 9
PAINT STEP(0, 0), 0, 9

NEXT

IF bcnt <= 13 THEN

CIRCLE (bstart1 + 15, 350), 7, 14

ELSEIF bcnt > 13 THEN

CIRCLE (bstart1, 350), 7, 14

END IF

PAINT STEP(0, 0), 14, 14

FOR i = 1 TO 4 STEP 1

CIRCLE STEP(15, 0), 7, 14
PAINT STEP(0, 0), 14, 14

NEXT

END SUB

SUB level3

'bridge two animation

IF bcnt <= 12 THEN

CIRCLE (355, bstart2), 7, 9

ELSE

CIRCLE (355, bstart2 - 15), 7, 9

END IF

PAINT STEP(0, 0), 0, 9

FOR i = 1 TO 2 STEP 1

CIRCLE STEP(15, 0), 7, 9
PAINT STEP(0, 0), 0, 9

NEXT

IF bcnt <= 12 THEN

CIRCLE (355, bstart2 - 15), 7, 14

ELSE

CIRCLE (355, bstart2), 7, 14

END IF

PAINT STEP(0, 0), 14, 14

FOR i = 1 TO 2 STEP 1

CIRCLE STEP(15, 0), 7, 14
PAINT STEP(0, 0), 14, 14

NEXT

END SUB

px = 40: py = 305

GOSUB drawplyr

now! = TIMER
now2! = TIMER

DO

'collisions and empty space(gravity)

newnow! = TIMER

IF POINT(px, py + 45) = 0 AND newnow! - now! >= grav AND py < 330 THEN

GOSUB clrplyr
py = py + 15

GOSUB drawplyr

grav = grav / 1.12 'acceleration factor

now! = TIMER

ELSEIF POINT(px, py + 45) > 0 THEN

grav = .08

END IF

'bottom of screen

IF py >= 330 THEN CALL loose

'red x win collison

IF POINT(px + 15, py) = 4 OR POINT(px + 15, py + 15) = 4 OR POINT(px + 15, py + 30) = 4 THEN EXIT DO

IF POINT(px - 15, py) = 4 OR POINT(px - 15, py + 15) = 4 OR POINT(px - 15, py + 30) = 4 THEN EXIT DO

'LOCATE 1, 1: PRINT px, py, grav, bflag

'level code

IF level = 1 THEN

IF POINT(px, py + 45) = 7 AND px <> 340 THEN

GOSUB clrplyr
px = 340: py = 95
GOSUB drawplyr

END IF

ELSEIF level = 2 THEN

bnow! = TIMER

IF bnow! - now2! >= .4 THEN

now2! = TIMER

bcnt = bcnt + 1

CALL level2

IF bcnt <= 13 THEN

bstart1 = bstart1 + 15

ELSEIF bcnt > 13 THEN

bstart1 = bstart1 - 15

END IF

IF bcnt = 25 THEN bcnt = 1

IF POINT(px, py + 45) = 14 THEN

IF bcnt > 1 AND bcnt < 13 THEN

GOSUB clrplyr
CALL level2
px = px + 15
GOSUB drawplyr

ELSEIF bcnt > 13 AND bcnt < 25 THEN

GOSUB clrplyr
CALL level2
px = px - 15
GOSUB drawplyr

END IF

END IF

END IF

ELSEIF level = 3 THEN

IF POINT(px, py + 45) = 7 AND px = 55 THEN

GOSUB clrplyr
py = 185: px = 520
GOSUB drawplyr

END IF

bnow! = TIMER

IF bnow! - now2! >= .4 THEN

now2! = TIMER

bcnt = bcnt + 1

CALL level3

IF bcnt > 1 AND bcnt <= 12 THEN

bstart2 = bstart2 - 15

ELSEIF bcnt > 12 THEN

bstart2 = bstart2 + 15

END IF

IF bcnt = 23 THEN bcnt = 1

'bridge contact

IF POINT(px, py + 45) = 14 THEN

IF bcnt > 1 AND bcnt < 12 THEN

GOSUB clrplyr
CALL level3
py = py - 15
GOSUB drawplyr

ELSEIF bcnt > 12 AND bcnt < 24 THEN

GOSUB clrplyr
CALL level3
py = py + 15
GOSUB drawplyr

END IF

END IF

END IF

END IF

' user input

kb\$ = INKEY\$

SELECT CASE kb\$

CASE CHR\$(27)

SYSTEM

CASE CHR\$(0) + CHR\$(72) 'jump button

IF POINT(px, py - 15) = 0 AND POINT(px, py + 45) > 0 THEN

FOR i = 1 TO 5 STEP 1

GOSUB clrplyr
IF POINT(px, py - 15) = 0 AND py > 80 THEN py = py - 15
GOSUB drawplyr
now! = TIMER

DO

newnow! = TIMER

LOOP UNTIL newnow! - now! >= .05
NEXT

END IF

CASE CHR\$(13)

EXIT DO

CASE CHR\$(0) + CHR\$(77)

IF POINT(px + 15, py) = 0 AND POINT(px + 15, py + 15) = 0 AND POINT(px + 15, py + 30) = 0 THEN

GOSUB clrplyr
IF px < 610 THEN px = px + 15
GOSUB drawplyr

END IF

CASE CHR\$(0) + CHR\$(75)

IF POINT(px - 15, py) = 0 AND POINT(px - 15, py + 15) = 0 AND POINT(px - 15, py + 30) = 0 THEN

GOSUB clrplyr
IF px > 25 THEN px = px - 15
GOSUB drawplyr

END IF

END SELECT

LOOP

GOTO btm

drawplyr:

CIRCLE (px, py), 7, 1
PAINT (px, py), 1, 1
CIRCLE STEP(0, 15), 7, 1
PAINT STEP(0, 0), 1, 1
CIRCLE STEP(0, 15), 7, 1
PAINT STEP(0, 0), 1, 1
RETURN

clrplyr:

CIRCLE (px, py), 7, 9
PAINT (px, py), 0, 9
CIRCLE STEP(0, 15), 7, 9
PAINT STEP(0, 0), 0, 9
CIRCLE STEP(0, 15), 7, 9
PAINT STEP(0, 0), 0, 9
RETURN

btm:

END SUB

SUB loose

'SYSTEM
RUN

END SUB

SUB startgame
SCREEN 12

DIM cx AS INTEGER, cy AS INTEGER, cnt AS INTEGER

cx = 25: cy = 80

OUT &H3C8, 9: OUT &H3C9, 19: OUT &H3C9, 19: OUT &H3C9, 49

FOR i = 1 TO 800 STEP 1

CIRCLE (cx, cy), 7, n

IF n <> 9 THEN PAINT (cx, cy), n, n ELSE PAINT (cx, cy), 0, n

cx = cx + 15

cnt = cnt + 1

IF cnt MOD 40 = 0 THEN

cy = cy + 15
cx = 25

END IF

NEXT

END SUB

 This message has been edited by unseenmachine on May 15, 2010 5:49 PMThis message has been edited by unseenmachine on May 14, 2010 6:16 PM

 Respond to this message

# *Geat game Unseen! Thanks for sharing it. I won it but it game me RSI!

June 2 2010, 4:34 AM
 Respond to this message
Unseen Machine

# Thanks..

June 2 2010, 4:49 AM
 I am currently working on the v.01 QB64 version of the level creator, which (when the levels are loaded in to the game player - not yet coded) uses the same movement and design but is in scrolling worlds form rather than static levels. It will be a while before i release that yet as i want it to be fully functional. UNSEEN
 Respond to this message

R

# SLR Game 1 - Map Editor and code generator v.01.1

May 18 2010, 10:28 AM

It took 4 days of hard head scratching and several other programmes to convert stuff for me to get this far. I think that i have ironed out most bugs that i can find, if anyone finds any please report them. If anyone has any idea for the programme (not to hard though please) or any tips on how to improve it please let me know.

I am begining to feel as if i am the only person who does QBasic anymore...come on folks!!!

- Note to qb64 users - i have noticed a problem when trying to paint whilst holding down the mouse. It seem to reposition itself for some reason.

Basic Edition v.01 features...

- Generate maps(10 levels max)
- Transporters(1 pair per level - 1 way transport)
- Player Start/Exit posistioning
- Autosave level on new level
- Automatic code generator - No Need to write any code at all!!!!
- Multiple map sets (custom save names)
- Basic error checking

- Bridge's (1 per level) (custom size and movement(distance NOT direction)
- Show entire matrix / only show solids option
- Duck Down control
- Variable Gravity
- Empty level check
- Other bug fixes
- Improved error checking
- Level delete (with option to re-organise array)

WARNING!!! When saving files are saved to C:\ as .bas, so be careful!!

NOTE - I have updated this code to version .01.1 0 which has some pretty serious bug fixes and improved useabilty (exit points can now be moved without clearing the whole level!)

CODE --------

'QB JUMP Map Editor and Code Generator - Basic Edition v.01.1
'By Unseen Machine

DECLARE SUB buildgame ()
DECLARE SUB savelevel ()
DECLARE SUB clrgrid ()
DECLARE SUB draweditor ()

'variables that are going to be written into the code
DIM SHARED t1x(1 TO 10) AS INTEGER, t2x(1 TO 10) AS INTEGER
DIM SHARED t1y(1 TO 10) AS INTEGER, t2y(1 TO 10) AS INTEGER
DIM SHARED map(1 TO 10, 800) AS INTEGER
DIM SHARED gpx(1 TO 10) AS INTEGER, gpy(1 TO 10) AS INTEGER

DIM mxmin AS INTEGER, mxmax AS INTEGER, mymin AS INTEGER, mymax AS INTEGER
DIM rowcnt AS INTEGER, colcnt AS INTEGER, clr AS INTEGER
DIM clrymin AS INTEGER, itmcnt AS INTEGER, item AS STRING
DIM SHARED tranflag1(1 TO 10) AS INTEGER, tranflag2(1 TO 10) AS INTEGER
DIM SHARED px(1 TO 10) AS INTEGER, py(1 TO 10) AS INTEGER
DIM SHARED level AS INTEGER, plyrflag(1 TO 10) AS INTEGER
DIM SHARED exitflag(1 TO 10) AS INTEGER
DIM SHARED levelmax AS INTEGER
DIM SHARED xitx(1 TO 10) AS INTEGER, xity(1 TO 10) AS INTEGER

CLS
SCREEN 12

CALL draweditor

level = 1

DIM SHARED m(8) AS LONG, mb AS INTEGER, mx AS INTEGER, my AS INTEGER
m(0) = &H8BE58955
m(1) = &H78B0C5E
m(2) = &HD88933CD
m(3) = &H890A5E8B
m(4) = &H85E8B07
m(5) = &H5E8B0F89
m(6) = &H5D178906
m(7) = &H8CA
DEF SEG = VARSEG(m(0))

CALL ABSOLUTE(1, mb, mx, my, VARPTR(m(0)))
CALL ABSOLUTE(3, mb, mx, my, VARPTR(m(0)))

DO

IF level > levelmax THEN levelmax = level

LOCATE 4, 41: PRINT "Level :"; level

IF itmcnt = 0 THEN

item = "Background "
clr = 0

ELSEIF itmcnt = 1 THEN

item = "Player Start"
clr = 1

ELSEIF itmcnt = 2 THEN

item = "Ground "
clr = 2

ELSEIF itmcnt = 3 THEN

item = "Exit Point "
clr = 4

ELSEIF itmcnt = 4 THEN

item = "Dirt "
clr = 6

ELSEIF itmcnt = 5 THEN

item = "Transporter "
clr = 15

END IF

mxmin = 170: mxmax = 570
mymin = 75: mymax = 275
clrymin = 96

COLOR 15

' LOCATE 27, 1: PRINT "mx : "; mx; "my : "; my
LOCATE 15, 3: PRINT "Item :"
LOCATE 17, 6: PRINT item
LOCATE 19, 36: PRINT "Column :"; colcnt
LOCATE 19, 50: PRINT "Row :"; rowcnt

CALL ABSOLUTE(3, mb, mx, my, VARPTR(m(0)))

'Next level button

IF mx >= 410 AND mx <= 415 AND my >= 50 AND my <= 60 THEN

IF mb = 1 THEN

IF level < 10 THEN

CALL savelevel
CALL clrgrid
level = level + 1

END IF

END IF

END IF

'previous level button

IF mx >= 305 AND mx <= 310 AND my >= 50 AND my <= 60 THEN

IF mb = 1 THEN

IF level > 1 THEN

CALL savelevel
CALL clrgrid
level = level - 1
END IF

END IF

END IF

'build game button

IF mx >= 290 AND mx <= 382 AND my >= 315 AND my <= 340 THEN

IF mb = 1 THEN

CALL buildgame

END IF

END IF

'clear grid button

IF mx >= 170 AND mx <= 270 AND my >= 315 AND my <= 340 THEN

IF mb = 1 THEN

CALL clrgrid
plyrflag(level) = 0
tranflag1(level) = 0
tranflag2(level) = 0
exitflag(level) = 0

END IF

END IF

'mouse functions in the item area

IF mx >= 28 AND mx <= 138 AND my >= 95 AND my <= 205 THEN

IF mb = 1 THEN

itmcnt = 0

DO
IF my >= clrymin AND my <= clrymin + 16 THEN

EXIT DO

ELSE

itmcnt = itmcnt + 1
clrymin = clrymin + 16

END IF

LOOP

END IF

END IF

'mouse functions in the grid area

IF mx >= 170 AND mx <= 570 AND my >= 75 AND my <= 275 THEN

'row and column data

colcnt = 1

DO

IF mx >= mxmin AND mx <= mxmin + 10 THEN

EXIT DO

ELSE

colcnt = colcnt + 1
mxmin = mxmin + 10

END IF

LOOP

rowcnt = 1

DO

IF my >= mymin AND my <= mymin + 10 THEN

EXIT DO

ELSE

rowcnt = rowcnt + 1
mymin = mymin + 10
END IF

LOOP

IF mb = 1 THEN

CALL ABSOLUTE(2, mb, mx, my, VARPTR(m(0)))

IF itmcnt = 1 THEN 'player start positioning

IF rowcnt <= 17 AND plyrflag(level) = 0 THEN

PAINT (mxmin + 5, mymin + 5), clr, 7

FOR i = 1 TO 2 STEP 1

PAINT STEP(0, 10), clr, 7

NEXT

ELSE

PAINT (px(level), py(level)), 0, 7

FOR i = 1 TO 2 STEP 1

PAINT STEP(0, 10), 0, 7

NEXT

plyrflag = 0

PAINT (mxmin + 5, mymin + 5), clr, 7

FOR i = 1 TO 2 STEP 1

PAINT STEP(0, 10), clr, 7

NEXT

END IF

plyrflag(level) = 1
px(level) = (mxmin + 5)
py(level) = (mymin + 5)

gpx(level) = ((mxmin) - 150) + (colcnt * 5)
gpy(level) = (mymin) + (rowcnt * 5)

ELSEIF itmcnt = 3 THEN

IF exitflag(level) = 0 THEN

exitflag(level) = 1

ELSE
PAINT (xitx(level), xity(level)), 0, 7

END IF

xitx(level) = mxmin + 5: xity(level) = mymin + 5
PAINT (mxmin + 5, mymin + 5), 4, 7

ELSEIF itmcnt = 5 THEN

IF tranflag1(level) = 1 AND tranflag2(level) = 0 AND rowcnt > 3 THEN

t2x(level) = (mxmin - 150) + (colcnt * 5)
t2y(level) = (mymin + (rowcnt * 5))
tranflag2(level) = 1
PAINT (mxmin + 5, mymin + 5), 15, 7

END IF

IF tranflag1(level) = 0 AND rowcnt > 3 THEN

t1x(level) = (mxmin - 150) + (colcnt * 5)
t1y(level) = (mymin + (rowcnt * 5))
tranflag1(level) = 1
PAINT (mxmin + 5, mymin + 5), 15, 7

END IF

DO

CALL ABSOLUTE(3, mb, mx, my, VARPTR(m(0)))

LOOP UNTIL mb = 0

ELSE

IF POINT(mxmin + 5, mymin + 5) <> 1 AND POINT(mxmin + 5, mymin + 5) <> 15 AND POINT(mxmin + 5, mymin + 5) <> 4 THEN

PAINT (mxmin + 5, mymin + 5), clr, 7

END IF

END IF

CALL ABSOLUTE(1, mb, mx, my, VARPTR(m(0)))

END IF

END IF

kb\$ = INKEY\$

SELECT CASE kb\$

CASE CHR\$(27)

SYSTEM

END SELECT

LOOP

SYSTEM

SUB buildgame

DIM cnt AS INTEGER, lvlcnt AS INTEGER

'check each level for player start - exit and transporters

CALL savelevel

DO

lvlcnt = lvlcnt + 1

IF tranflag1(lvlcnt) = 1 AND tranflag2(lvlcnt) = 0 THEN

msg\$ = "Error on level " + STR\$(lvlcnt) + " - No second transporter point."
GOSUB builderror

END IF

IF px(lvlcnt) <= 0 OR plyrflag(level) = 0 THEN

msg\$ = "Error on level " + STR\$(lvlcnt) + " - No player start point."
GOSUB builderror

END IF

IF exitflag(lvlcnt) <= 0 THEN

msg\$ = "Error on level " + STR\$(lvlcnt) + " - No exit point."
GOSUB builderror

END IF

LOOP UNTIL lvlcnt = levelmax

lvlcnt = 0

DO

LOCATE 25, 1: PRINT SPACE\$(60)
LOCATE 25, 1: INPUT "Enter a name for your game : ", gname\$

LOOP UNTIL LEN(gname\$) > 0

CLOSE
OPEN "c:\" + gname\$ + ".bas" FOR OUTPUT AS #1

PRINT #1, "DECLARE SUB loose ()"
PRINT #1, "DECLARE SUB loadplayer ()"
PRINT #1, "DECLARE SUB startgame ()"
PRINT #1, ""
PRINT #1, "DIM SHARED level AS INTEGER"
PRINT #1, "DIM SHARED grav AS SINGLE"
PRINT #1, "DIM SHARED px(1 to 10) AS INTEGER, py(1 to 10) AS INTEGER"
PRINT #1, "dim shared t1x(1 to 10) as integer,t1y(1 to 10) as integer"
PRINT #1, "dim shared t2x(1 to 10) as integer,t2y(1 to 10) as integer"

PRINT #1, ""
PRINT #1, "grav = .08"
PRINT #1, ""
PRINT #1, "DO"
PRINT #1, " level = level + 1"
PRINT #1, " CALL startgame"
PRINT #1, " "
PRINT #1, " "
PRINT #1, ""
PRINT #1, "LOOP UNTIL level = "; levelmax

'level array to data covertor
DO

lvlcnt = lvlcnt + 1
cnt = 0

DO

text\$ = "DATA "

DO

IF cnt > 0 AND cnt MOD 40 <> 0 THEN

text\$ = text\$ + "," + STR\$(map(lvlcnt, cnt))

ELSE

text\$ = text\$ + STR\$(map(lvlcnt, cnt))

END IF

cnt = cnt + 1

LOOP UNTIL cnt MOD 40 = 0

PRINT #1, text\$

LOOP UNTIL cnt = 800

PRINT #1, ""

LOOP UNTIL lvlcnt = levelmax

PRINT #1, ""
PRINT #1, ""

'player start points for each level

lvlcnt = 0

DO

lvlcnt = lvlcnt + 1
PRINT #1, "px(" + STR\$(lvlcnt) + ") = "; gpx(lvlcnt); ":py(" + STR\$(lvlcnt) + ") = "; gpy(lvlcnt)

LOOP UNTIL lvlcnt = levelmax

PRINT #1, ""

'transporter points for each level

lvlcnt = 0

DO

lvlcnt = lvlcnt + 1
PRINT #1, "t1x(" + STR\$(lvlcnt) + ") = "; t1x(lvlcnt)
PRINT #1, "t1y(" + STR\$(lvlcnt) + ") = "; t1y(lvlcnt)
PRINT #1, "t2x(" + STR\$(lvlcnt) + ") = "; t2x(lvlcnt)
PRINT #1, "t2y(" + STR\$(lvlcnt) + ") = "; t2y(lvlcnt)

LOOP UNTIL lvlcnt = levelmax

PRINT #1, ""
PRINT #1, "GOSUB drawplyr"
PRINT #1, ""
PRINT #1, "now! = TIMER"
PRINT #1, "now2! = TIMER"
PRINT #1, ""
PRINT #1, "DO"
PRINT #1, ""
PRINT #1, " 'collisions and empty space(gravity)"
PRINT #1, ""
PRINT #1, " newnow! = TIMER"
PRINT #1, ""
PRINT #1, " IF POINT(px(level), py(level) + 45) = 0 AND newnow! - now! >= grav AND py(level) < 330 THEN"
PRINT #1, ""
PRINT #1, " GOSUB clrplyr"
PRINT #1, " py(level) = py(level) + 15"
PRINT #1, ""
PRINT #1, " GOSUB drawplyr"
PRINT #1, ""
PRINT #1, " grav = grav / 1.12 'acceleration factor"
PRINT #1, ""
PRINT #1, " now! = TIMER"
PRINT #1, ""
PRINT #1, " ELSEIF POINT(px(level), py(level) + 45) > 0 THEN"
PRINT #1, ""
PRINT #1, " grav = .08"
PRINT #1, ""
PRINT #1, " END IF"
PRINT #1, ""
PRINT #1, ""
PRINT #1, " 'tranposrters"
PRINT #1, ""
PRINT #1, " IF POINT(px(level), py(level) + 45) =15 THEN"
PRINT #1, ""
PRINT #1, " if px(level) = t1x(level) and py(level)+45 = t1y(level) then "
PRINT #1, ""
PRINT #1, " gosub clrplyr"
PRINT #1, " px(level) = t2x(level) "
PRINT #1, " py(level) = t2y(level) - 45"
PRINT #1, " GOSUB drawplyr"
PRINT #1, ""
PRINT #1, " END IF "
PRINT #1, ""
PRINT #1, " end if "
PRINT #1, ""
PRINT #1, " 'bottom of screen"
PRINT #1, ""
PRINT #1, " IF py(level) >= 330 THEN CALL loose"
PRINT #1, ""
PRINT #1, " 'red x win collison"
PRINT #1, ""
PRINT #1, " IF POINT(px(level) + 15, py(level)) = 4 OR POINT(px(level) + 15, py(level) + 15) = 4 OR POINT(px(level) + 15, py(level) + 30) = 4 THEN EXIT DO"
PRINT #1, ""
PRINT #1, " IF POINT(px(level) - 15, py(level)) = 4 OR POINT(px(level) - 15, py(level) + 15) = 4 OR POINT(px(level) - 15, py(level) + 30) = 4 THEN EXIT DO"
PRINT #1, ""
PRINT #1, " ' user input"
PRINT #1, ""
PRINT #1, " kb\$ = INKEY\$"
PRINT #1, ""
PRINT #1, " SELECT CASE kb\$"
PRINT #1, ""
PRINT #1, " CASE CHR\$(27)"
PRINT #1, ""
PRINT #1, " SYSTEM"
PRINT #1, ""
PRINT #1, " CASE CHR\$(0) + CHR\$(72) 'jump button"
PRINT #1, ""
PRINT #1, " IF POINT(px(level), py(level) - 15) = 0 AND POINT(px(level), py(level) + 45) > 0 THEN"
PRINT #1, ""
PRINT #1, " FOR i = 1 TO 5 STEP 1"
PRINT #1, ""
PRINT #1, " GOSUB clrplyr"
PRINT #1, " IF POINT(px(level), py(level) - 15) = 0 AND py(level) > 80 THEN py(level) = py(level) - 15"
PRINT #1, " GOSUB drawplyr"
PRINT #1, " now! = TIMER"
PRINT #1, ""
PRINT #1, " DO"
PRINT #1, ""
PRINT #1, " newnow! = TIMER"
PRINT #1, ""
PRINT #1, " LOOP UNTIL newnow! - now! >= .05"
PRINT #1, ""
PRINT #1, " NEXT"
PRINT #1, ""
PRINT #1, " END IF"
PRINT #1, ""
PRINT #1, " CASE CHR\$(13)"
PRINT #1, ""
PRINT #1, " EXIT DO"
PRINT #1, ""
PRINT #1, " CASE CHR\$(0) + CHR\$(77)"
PRINT #1, ""
PRINT #1, " IF POINT(px(level) + 15, py(level)) = 0 AND POINT(px(level) + 15, py(level) + 15) = 0 AND POINT(px(level) + 15, py(level) + 30) = 0 THEN"
PRINT #1, ""
PRINT #1, " GOSUB clrplyr"
PRINT #1, " IF px(level) < 610 THEN px(level) = px(level) + 15"
PRINT #1, " GOSUB drawplyr"
PRINT #1, ""
PRINT #1, " END IF"
PRINT #1, ""
PRINT #1, " CASE CHR\$(0) + CHR\$(75)"
PRINT #1, ""
PRINT #1, " IF POINT(px(level) - 15, py(level)) = 0 AND POINT(px(level) - 15, py(level) + 15) = 0 AND POINT(px(level) - 15, py(level) + 30) = 0 THEN"
PRINT #1, ""
PRINT #1, " GOSUB clrplyr"
PRINT #1, " IF px(level) > 25 THEN px(level) = px(level) - 15"
PRINT #1, " GOSUB drawplyr"
PRINT #1, ""
PRINT #1, " END IF"
PRINT #1, ""
PRINT #1, ""
PRINT #1, " END SELECT"
PRINT #1, ""
PRINT #1, "LOOP"
PRINT #1, ""
PRINT #1, "GOTO btm"
PRINT #1, ""
PRINT #1, "drawplyr:"
PRINT #1, ""
PRINT #1, "CIRCLE (px(level), py(level)), 7, 1"
PRINT #1, "PAINT (px(level), py(level)), 1, 1"
PRINT #1, "CIRCLE STEP(0, 15), 7, 1"
PRINT #1, "PAINT STEP(0, 0), 1, 1"
PRINT #1, "CIRCLE STEP(0, 15), 7, 1"
PRINT #1, "PAINT STEP(0, 0), 1, 1"
PRINT #1, "RETURN"
PRINT #1, ""
PRINT #1, "clrplyr:"
PRINT #1, ""
PRINT #1, "CIRCLE (px(level), py(level)), 7, 9"
PRINT #1, "PAINT (px(level), py(level)), 0, 9"
PRINT #1, "CIRCLE STEP(0, 15), 7, 9"
PRINT #1, "PAINT STEP(0, 0), 0, 9"
PRINT #1, "CIRCLE STEP(0, 15), 7, 9"
PRINT #1, "PAINT STEP(0, 0), 0, 9"
PRINT #1, "RETURN"
PRINT #1, ""
PRINT #1, ""
PRINT #1, "btm:"
PRINT #1, ""
PRINT #1, "END SUB"
PRINT #1, ""
PRINT #1, "SUB loose"
PRINT #1, "CLS"
PRINT #1, "LOCATE 15, 30: PRINT" + CHR\$(34) + " YOU DIED FOOL!" + CHR\$(34)
PRINT #1, "SLEEP"
PRINT #1, "'SYSTEM"
PRINT #1, "RUN"
PRINT #1, ""
PRINT #1, ""
PRINT #1, "END SUB"
PRINT #1, ""
PRINT #1, "SUB startgame"
PRINT #1, "SCREEN 12"
PRINT #1, ""
PRINT #1, "DIM cx AS INTEGER, cy AS INTEGER, cnt AS INTEGER"
PRINT #1, ""
PRINT #1, "cx = 25: cy = 80"
PRINT #1, ""
PRINT #1, "OUT &H3C8, 9: OUT &H3C9, 19: OUT &H3C9, 19: OUT &H3C9, 49"
PRINT #1, ""
PRINT #1, "FOR i = 1 TO 800 STEP 1"
PRINT #1, ""
PRINT #1, ""
PRINT #1, " if n = 0 then "
PRINT #1, ""
PRINT #1, " circle(cx, cy),7,9"
PRINT #1, " paint step(0,0),0,9"
PRINT #1, ""
PRINT #1, " else"
PRINT #1, ""
PRINT #1, " CIRCLE (cx, cy), 7, n"
PRINT #1, " PAINT (cx, cy), n, n"
PRINT #1, ""
PRINT #1, " END IF"
PRINT #1, " cx = cx + 15"
PRINT #1, ""
PRINT #1, " cnt = cnt + 1"
PRINT #1, ""
PRINT #1, " IF cnt MOD 40 = 0 THEN"
PRINT #1, ""
PRINT #1, " cy = cy + 15"
PRINT #1, " cx = 25"
PRINT #1, ""
PRINT #1, " END IF"
PRINT #1, ""
PRINT #1, "NEXT"
PRINT #1, ""
PRINT #1, "END SUB"

LOCATE 25, 1: PRINT SPACE\$(60)
LOCATE 25, 1: PRINT "File created at location C:\" + gname\$ + ".bas"

GOTO subend

builderror:

LOCATE 25, 1: PRINT SPACE\$(60)
LOCATE 25, 1: PRINT msg\$

subend:

END SUB

SUB clrgrid

DIM cx AS INTEGER, cy AS INTEGER, cnt AS INTEGER, clr AS INTEGER

cx = 175: cy = 80

DO

PAINT (cx, cy), 0, 7

cx = cx + 10

cnt = cnt + 1

IF cnt MOD 40 = 0 THEN

cy = cy + 10
cx = 175

END IF

LOOP UNTIL cnt = 800

END SUB

SUB draweditor

CLS

COLOR 8

LOCATE 1, 1: PRINT "QB Jump Map Editor & Code Generator Basic Edition v.01.1"

COLOR 15

'main grid

DIM cx AS INTEGER, cy AS INTEGER, cnt AS INTEGER, clr AS INTEGER

cx = 175: cy = 80

DO

CIRCLE (cx, cy), 5, 7

cx = cx + 10

cnt = cnt + 1

IF cnt MOD 40 = 0 THEN

cy = cy + 10
cx = 175

END IF

LOOP UNTIL cnt = 800

LOCATE 7, 8: PRINT "Background"
LOCATE 8, 8: PRINT "Player Start"
LOCATE 9, 8: PRINT "Ground"
LOCATE 10, 8: PRINT "Exit Point"
LOCATE 11, 8: PRINT "Dirt"
LOCATE 12, 8: PRINT "Transporter"
COLOR 8: LOCATE 13, 8: PRINT "Bridge": COLOR 15

cx = 36: cy = 103: cnt = 0

FOR i = 1 TO 7 STEP 1

CIRCLE (cx, cy), 7, 15

IF cnt > 2 THEN

IF cnt = 3 THEN clr = 4
IF cnt = 4 THEN clr = 6
IF cnt = 5 THEN clr = 15
IF cnt = 6 THEN clr = 14

ELSE

clr = cnt

END IF

PAINT STEP(0, 0), clr, 15

cnt = cnt + 1
cy = cy + 16

NEXT

COLOR 2

LOCATE 21, 23: PRINT "Clear Level"
LINE (170, 315)-(270, 340), 10, B

LOCATE 21, 38: PRINT "Build Game"
LINE (290, 315)-(382, 340), 10, B

'red line for bridge & teleport (not yet coded - v.02 or maybe standard edition)
LINE (24, 200)-(144, 200), 4
'LINE (24, 184)-(144, 184), 4

'level arrows

PSET (310, 55), 2: DRAW "d5h5e5d5"
PAINT STEP(-1, 0), 10, 2

PSET (410, 55), 2: DRAW "d5e5h5d5"
PAINT STEP(1, 0), 10, 2

END SUB

DIM cx AS INTEGER, cy AS INTEGER, cnt AS INTEGER, clr AS INTEGER

cx = 175: cy = 80

DO

clr = map(level, cnt)

PAINT (cx, cy), clr, 7

cx = cx + 10

cnt = cnt + 1

IF cnt MOD 40 = 0 THEN

cy = cy + 10
cx = 175

END IF

LOOP UNTIL cnt = 800

END SUB

SUB savelevel

DIM cx AS INTEGER, cy AS INTEGER, cnt AS INTEGER, clr AS INTEGER

cx = 175: cy = 80

DO

IF POINT(cx, cy) <> 1 THEN

map(level, cnt) = POINT(cx, cy)

ELSE

map(level, cnt) = 0

END IF

cx = cx + 10

cnt = cnt + 1

IF cnt MOD 40 = 0 THEN

cy = cy + 10
cx = 175

END IF

LOOP UNTIL cnt = 800

END SUB

 This message has been edited by unseenmachine on May 18, 2010 7:14 PM

 Respond to this message

R

# SLR Game 1 - Map Editor and code generator v.01.4

May 22 2010, 7:50 AM
 Respond to this message

R

# QB Jump - Map Editor and code generator v.01.5

May 24 2010, 6:15 PM
 Respond to this message

R

# SLR Game _ BRick Smash v.01

June 11 2010, 5:54 AM
 Based on breakout, this is a final tweaked version of .01. Let me know what you think, UNSEEN. code.... 'SLR Games - Brick Smash v.01 - By Unseen Machine DIM SHARED scrn AS LONG, cx AS INTEGER, cy AS INTEGER, pflag AS INTEGER, bcnt AS INTEGER DIM SHARED fnt AS LONG, px AS INTEGER, py AS INTEGER, oldpx AS INTEGER, oldpy AS INTEGER DIM SHARED KeyDown(127) AS LONG, bx AS INTEGER, by AS INTEGER, bdirect AS INTEGER DIM SHARED colcnt AS INTEGER, rowcnt AS INTEGER, brick(1 TO 7, 1 TO 5) AS INTEGER DIM SHARED lives AS INTEGER RANDOMIZE TIMER _TITLE " Brick Smash v.01" scrn = _NEWIMAGE(1200, 900, 12) SCREEN scrn, , 1, 1 CALL drawgrid CALL Drawbricks px = 540: py = 610: pflag = 1 rndm = INT(RND * 5) + 1 bx = 560: by = 390 FOR c = 1 TO rndm by = by - 20 NEXT bdinitial = INT(RND * 2) IF bdinitial = 1 THEN bdirect = 4 ELSE bdirect = 2 lives = 3 GOSUB drawpaddle _DELAY 1 now! = TIMER bnow! = TIMER DO LOCATE 2, 30: PRINT "Lives : ", lives IF bcnt = 35 THEN GOSUB win newnow! = TIMER bnow2! = TIMER colcnt = (bx - 100) / 20 rowcnt = (by - 50) / 20 IF pflag = 2 THEN GOSUB clrpaddle IF pflag = 1 THEN GOSUB drawpaddle IF newnow! - now! >= .1 THEN CALL control CALL collision now! = TIMER END IF IF bnow2! - bnow! >= .15 THEN CALL Ball bnow! = TIMER END IF LOOP drawpaddle: oldpx = px FOR i = 1 TO 4 PAINT (px, py), 15, 7 px = px + 20 NEXT px = oldpx pflag = 0 RETURN clrpaddle: FOR i = 1 TO 4 PAINT (oldpx, py), 0, 7 oldpx = oldpx + 20 NEXT pflag = 1 RETURN win: CLS LOCATE 5, 30: PRINT "Well Done = You have completed the game." _DELAY 5 SYSTEM SUB collision colstart = 2 rowstart = 2 FOR b = 1 TO 5 IF rowcnt = rowstart THEN FOR a = 1 TO 7 IF colcnt >= colstart AND colcnt <= colstart + 4 THEN IF brick(a, b) = 0 THEN bcnt = bcnt + 1 brick(a, b) = 1 CALL Drawbricks IF bdirect = 1 THEN bdirect = 4 IF bdirect = 3 THEN bdirect = 2 END IF END IF colstart = colstart + 7 NEXT a END IF rowstart = rowstart + 3 NEXT END SUB SUB Ball PAINT (bx, by), 0, 7 IF by >= 610 AND lives = 0 THEN RUN ELSEIF by >= 610 THEN lives = lives - 1 bx = 560: by = 390 _DELAY 1 FOR c = 1 TO rndm by = by - 20 NEXT bdinitial = INT(RND * 2) IF bdinitial = 1 THEN bdirect = 4 ELSE bdirect = 2 px = 540: py = 610: pflag = 2 END IF IF POINT(bx + 20, by + 20) = 15 AND bdirect = 2 THEN bdirect = 3 IF POINT(bx, by + 20) = 15 AND bdirect = 2 THEN bdirect = 3 IF POINT(bx - 20, by + 20) = 15 AND bdirect = 4 THEN bdirect = 1 IF POINT(bx, by + 20) = 15 AND bdirect = 2 THEN bdirect = 3 IF bdirect = 3 AND bx = 1080 THEN bdirect = 1 IF bdirect = 1 AND by = 50 THEN bdirect = 4 IF bdirect = 4 AND bx = 100 THEN bdirect = 2 IF bdirect = 1 AND bx = 100 THEN bdirect = 3 IF bdirect = 3 AND by = 50 THEN bdirect = 2 IF bdirect = 2 AND bx = 1080 THEN bdirect = 4 IF bdirect = 1 THEN 'up left IF by > 50 THEN by = by - 20 IF bx > 100 THEN bx = bx - 20 ELSEIF bdirect = 2 THEN 'down right IF by < 620 THEN by = by + 20 IF bx < 1080 THEN bx = bx + 20 ELSEIF bdirect = 3 THEN 'up right IF by > 50 THEN by = by - 20 IF bx < 1080 THEN bx = bx + 20 ELSEIF bdirect = 4 THEN ' down left IF by < 620 THEN by = by + 20 IF bx > 100 THEN bx = bx - 20 END IF PAINT (bx, by), 1, 7 END SUB SUB drawgrid cx = 100: cy = 50 FOR i = 1 TO 1500 CIRCLE (cx, cy), 10, 7 cx = cx + 20 IF i MOD 50 = 0 THEN cx = 100: cy = cy + 20 NEXT i END SUB SUB Drawbricks cx = 140: cy = 90 FOR k = 1 TO 5 FOR j = 1 TO 7 FOR i = 1 TO 4 IF POINT(cx, cy) = 0 AND brick(j, k) = 0 THEN PAINT (cx, cy), 6, 7 ELSEIF brick(j, k) = 1 THEN PAINT (cx, cy), 0, 7 END IF cx = cx + 20 NEXT i cx = cx + 60 NEXT j cx = 140 cy = cy + 60 NEXT END SUB SUB control 'Galleoans INP(&H60) routine for keyboard input - logs multiple keys 'update keydown states i& = INP(&H60) DO IF (i& AND 128) THEN KeyDown(i& XOR 128) = 0 IF (i& AND 128) = 0 THEN KeyDown(i&) = -1 i2& = i& i& = INP(&H60) LOOP UNTIL i& = i2& DO: LOOP UNTIL INKEY\$ = "" 'flush INKEY\$ buffer IF KeyDown(75) THEN oldpx = px IF px > 100 THEN px = px - 20 pflag = 2 END IF ELSEIF KeyDown(77) THEN oldpx = px IF px < 1020 THEN px = px + 20 pflag = 2 END IF END IF END SUB
 Respond to this message

# Good job!

June 11 2010, 6:59 AM
 I remember that game from Atari, back in the 1980's. I liked the collision effects and the ball tracked perfectly. A lot going on for a smaller program. I'm not sure if Galleon created graphics page flipping for QB64, I think he did. If so, you might want to add this concept to future projects to keep the shape of the paddle when in motion. I also wonder if there is a way to speed up redrawing of objects, to make the action faster? Thanks for posting it, Pete
 Respond to this message

# >02 will have better graphics

June 11 2010, 9:27 AM
 Thanks Pete, the animation is the one thing that annoyed me, in the next version I will use multiple pages, and thanks to Alpha blending and _putimage it should be much smoother.
 Respond to this message
Unseen Machine
R

# SLR Game - Qb Pong v.01

June 12 2010, 9:16 AM

This version has been slightly modified by galleon to give better graphics and to use less CPU. It only took me a few hours ro make, and the core of it is the same as Brick Smash, in fact it was Copied directly from it.

Updated CODE - BE warned this is for QB64 ONLY!!!!!

'SLR Game - Pong v.01 - By Unseen Machine - Thanks To Galleon And Pete for the enhancements

DIM SHARED scrn AS LONG, KeyDown(127) AS LONG
DIM SHARED px AS INTEGER, cx AS INTEGER, py AS INTEGER, cy AS INTEGER, pflag AS INTEGER
DIM SHARED bx AS INTEGER, by AS INTEGER, bdirect AS INTEGER, cdirect AS INTEGER
DIM SHARED lwall AS INTEGER, rwall AS INTEGER, pscore AS INTEGER, cscore AS INTEGER
DIM SHARED oldpx AS INTEGER, cflag AS INTEGER, pdirect AS INTEGER, sflag AS INTEGER
DIM SHARED oldcx AS INTEGER
RANDOMIZE TIMER

_TITLE "SLR Pong v.01"
scrn = _NEWIMAGE(1200, 900, 12)

SCREEN scrn, , 3, 1 'place a blank grid on this screen

CALL drawgrid

_PUTIMAGE , 3, 1

lwall = 100: rwall = 1080

cx = 560: cy = 70
px = 560: py = 810
pflag = 1: cflag = 1

bdirect = 2: cdirect = 2

bnow! = TIMER
now! = TIMER

SCREEN scrn, , 1, 1

DO

IF by = 50 OR by = 850 THEN sflag = 0

LOCATE 25, 140: PRINT cscore
LOCATE 31, 140: PRINT pscore

IF sflag = 0 THEN

cx = 560: cy = 70
px = 560: py = 810
pflag = 2: cflag = 2

sflag = INT(RND * 2) + 1

_DELAY 1

IF sflag = 1 THEN

bx = px + 20
by = py - 40

ELSEIF sflag = 2 THEN

bx = cx + 20
by = cy + 40
bd = INT(RND * 2) + 1
IF bd = 1 THEN bdirect = 2 ELSE bdirect = 4

END IF

END IF
colcnt = (bx - 100) / 20
rowcnt = (by - 50) / 20

bnow2! = TIMER
newnow! = TIMER

IF bnow2! - bnow! >= .04 THEN 'i found anything over .06 is almost impossible to beat

IF by = 70 THEN pscore = pscore + 1
IF by = 830 THEN cscore = cscore + 1

IF by > 70 AND by < 830 THEN

CALL ball

ELSE

sflag = 0
PAINT (bx, by), 0, 7

END IF

bnow! = TIMER

END IF

CALL control
CALL ccontrol
now! = TIMER

_DISPLAY 'manually refresh data to screen

_LIMIT 60 'limit of 30 frames per second to lower CPU usage, and allow input thread more processing time

LOOP

FOR i = 1 TO 3

PAINT (oldpx, py), 0, 7
oldpx = oldpx + 20

NEXT

oldpx = px
FOR i = 1 TO 3

PAINT (px, py), 15, 7
px = px + 20

NEXT
px = oldpx
pflag = 0

RETURN

FOR i = 1 TO 3

PAINT (oldcx, cy), 0, 7
oldcx = oldcx + 20

NEXT

oldcx = cx
FOR i = 1 TO 3

PAINT (cx, cy), 15, 7
cx = cx + 20

NEXT
cx = oldcx
RETURN

SUB ball

PAINT (bx, by), 0, 7

IF by < 450 THEN

IF POINT(bx + 20, by - 20) = 15 AND bdirect <> 5 THEN

IF cdirect = 1 THEN bdirect = 4
IF cdirect = 2 THEN

bd = INT(RND * 3) + 1
IF bd = 1 THEN bdirect = 2
IF bd = 2 THEN bdirect = 4
IF bd = 3 THEN bdirect = 6

END IF
IF cdirect = 3 THEN bdirect = 2

ELSEIF POINT(bx, by - 20) = 15 THEN

IF cdirect = 1 THEN bdirect = 4
IF cdirect = 2 THEN

bd = INT(RND * 3) + 1
IF bd = 1 THEN bdirect = 2
IF bd = 2 THEN bdirect = 4
IF bd = 3 THEN bdirect = 6

END IF

IF cdirect = 3 THEN bdirect = 2

ELSEIF POINT(bx - 20, by - 20) = 15 AND bdirect <> 5 THEN

IF cdirect = 1 THEN bdirect = 4
IF cdirect = 2 THEN

bd = INT(RND * 3) + 1
IF bd = 1 THEN bdirect = 2
IF bd = 2 THEN bdirect = 4
IF bd = 3 THEN bdirect = 6

END IF
IF cdirect = 3 THEN bdirect = 2

END IF

ELSEIF by > 450 THEN

IF POINT(bx + 20, by + 20) = 15 AND bdirect <> 6 THEN

IF pdirect = 1 THEN bdirect = 1
IF pdirect = 2 THEN bdirect = 5
IF pdirect = 3 THEN bdirect = 3

ELSEIF POINT(bx, by + 20) = 15 THEN

IF pdirect = 1 THEN bdirect = 1
IF pdirect = 2 THEN bdirect = 5
IF pdirect = 3 THEN bdirect = 3

ELSEIF POINT(bx - 20, by + 20) = 15 AND bdirect <> 6 THEN

IF pdirect = 1 THEN bdirect = 1
IF pdirect = 2 THEN bdirect = 5
IF pdirect = 3 THEN bdirect = 3

END IF
END IF

'Edges of Grid
IF bdirect = 3 AND bx = rwall THEN bdirect = 1
IF bdirect = 4 AND bx = lwall THEN bdirect = 2
IF bdirect = 1 AND bx = lwall THEN bdirect = 3
IF bdirect = 2 AND bx = rwall THEN bdirect = 4

IF bdirect = 1 THEN 'up left

by = by - 20
IF bx > 100 THEN bx = bx - 20

ELSEIF bdirect = 2 THEN 'down right

by = by + 20
IF bx < 1080 THEN bx = bx + 20

ELSEIF bdirect = 3 THEN 'up right

by = by - 20
IF bx < 1080 THEN bx = bx + 20

ELSEIF bdirect = 4 THEN ' down left

by = by + 20
IF bx > 100 THEN bx = bx - 20

ELSEIF bdirect = 5 THEN ' up

by = by - 20

ELSEIF bdirect = 6 THEN ' down

by = by + 20

END IF

PAINT (bx, by), 2, 7

END SUB

SUB ccontrol

IF cx < bx THEN

cdirect = 3

ELSEIF cx > bx THEN

cdirect = 1

ELSE

cdirect = 2

END IF

oldcx = cx

IF cdirect = 3 THEN

IF cx < rwall - 40 THEN cx = cx + 20
cflag = 2

ELSEIF cdirect = 1 THEN

IF cx > lwall THEN cx = cx - 20
cflag = 2

ELSE

cflag = 0

END IF

END SUB

SUB control

'Galleons INP(&H60) routine for keyboard input - logs multiple keys
'update keydown states
FOR z& = 1 TO 100
i& = INP(&H60)
IF (i& AND 128) THEN KeyDown(i& XOR 128) = 0
IF (i& AND 128) = 0 THEN KeyDown(i&) = -1
NEXT

IF KeyDown(75) THEN

oldpx = px
IF px > 100 THEN
px = px - 20
pflag = 2
END IF
pdirect = 1

ELSEIF KeyDown(77) THEN

oldpx = px
IF px < rwall - 40 THEN
px = px + 20
pflag = 2
END IF
pdirect = 3
ELSE

pdirect = 2

END IF

END SUB

SUB drawgrid

cx = 100: cy = 50

FOR i = 1 TO 2000

CIRCLE (cx, cy), 10, 7

IF i >= 951 AND i <= 1050 THEN PAINT STEP(0, 0), 7, 7

cx = cx + 20

IF i MOD 50 = 0 THEN

cx = 100
cy = cy + 20

END IF

NEXT

END SUB

 This message has been edited by unseenmachine on Jun 12, 2010 10:04 AM

 Respond to this message

R

# * Unseen is proliferous coder!

June 24 2010, 6:19 PM

 This message has been edited by burger2227 on Jun 24, 2010 6:20 PM

 Respond to this message
Ben

# Try making SLR tetris,

June 21 2010, 9:07 AM
 Respond to this message
Unseen Machine
R

# *Why dont you try?

June 22 2010, 12:13 PM
 Respond to this message

Moderator

# here's a simple snake implementation

September 16 2010, 6:04 PM
 as if the world doesn't have enough of them. i threw it together over the last hour or so, so the quality isn't too good. i haven't tested it much. there is no victory condition, the game keeps going until you hit something or press escape. the snake grows until it's length reaches the maxsl constant. i have a classic delay loop, but it is commented out. the game currently uses a timer loop. you can, if you want, comment out the timer loop, and use the classic delay loop instead. regards. 'public domain, 2010 michael calkins ' "qbasic" + "michael" + chr\$(&h40) + "gmail.com" 'CONST delayv& = 800000 CONST maxsl = 16 'maximum snake length DECLARE SUB drawcirc (x%, y%) DECLARE SUB drawmatrix () DEFINT A-Z DECLARE SUB blankmatrix () DIM SHARED fld(0 TO 39, 0 TO 19) TYPE snaket x AS INTEGER y AS INTEGER END TYPE DIM snake(0 TO maxsl) AS snaket RANDOMIZE TIMER FOR x = 0 TO 39 FOR y = 0 TO 19 fld(x, y) = 0 IF (x = 0) OR (x = 39) THEN fld(x, y) = 4 IF (y = 0) OR (y = 19) THEN fld(x, y) = 4 NEXT y, x drawmatrix SLEEP 2 snakel = 1 snake(0).x = 2 snake(0).y = 2 snakexdir = 1 snakeydir = 0 tx = -1 DO fld(snake(0).x, snake(0).y) = 3 drawcirc snake(0).x, snake(0).y IF tx = -1 THEN DO tx = INT(RND * 40) ty = INT(RND * 20) LOOP WHILE fld(tx, ty) fld(tx, ty) = 5 END IF drawcirc tx, ty s! = TIMER DO c! = TIMER IF c! < s! THEN s! = s! - 86400 LOOP UNTIL (c! - s!) >= .15 'FOR delay& = 0 TO delayv&: NEXT delay& k\$ = INKEY\$ SELECT CASE k\$ CASE CHR\$(&H1B): SCREEN 0: WIDTH 80, 25: SYSTEM CASE MKI\$(&H4800): snakexdir = 0: snakeydir = 1 CASE MKI\$(&H4B00): snakexdir = -1: snakeydir = 0 CASE MKI\$(&H4D00): snakexdir = 1: snakeydir = 0 CASE MKI\$(&H5000): snakexdir = 0: snakeydir = -1 END SELECT SELECT CASE fld(snake(0).x + snakexdir, snake(0).y + snakeydir) CASE 5 tx = -1 IF snakel < maxsl THEN snakel = snakel + 1: skip = -1 CASE 0 CASE ELSE: SCREEN 0: WIDTH 80, 25: SYSTEM END SELECT IF NOT skip THEN fld(snake(snakel - 1).x, snake(snakel - 1).y) = 0 drawcirc snake(snakel - 1).x, snake(snakel - 1).y END IF skip = 0 FOR i = snakel - 1 TO 1 STEP -1 snake(i).x = snake(i - 1).x snake(i).y = snake(i - 1).y NEXT i snake(0).x = snake(0).x + snakexdir snake(0).y = snake(0).y + snakeydir LOOP SUB drawcirc (x, y) cx = (x * 15) + 15 cy = ((20 - y) * 15) + 80 CIRCLE (cx, cy), 7, 8 PAINT (cx, cy), fld(x, y), 8 END SUB SUB drawmatrix CLS SCREEN 12 cx = 25: cy = 80 FOR x = 0 TO 39 FOR y = 0 TO 19 drawcirc x, y NEXT y, x END SUB
 Respond to this message
Unseen Machine

# Nicely Done MC

September 17 2010, 2:54 PM
 Works a dream in qb64. Shame that Ben never did respond to the tetris challenge though, but I am realy pleased that a least a few people have. I look forawrd too seeing a completed version in the future.
 Respond to this message

Moderator

# *thank you, but i don't intend to develop it more.

October 20 2010, 1:20 PM
 Respond to this message

Moderator

# *you could almost do a primitive minesweeper game...

October 20 2010, 1:20 PM
 Respond to this message

R

# * The scoll wheel FLEW off my mouse! Did you ever hear of PASTING over updated code? :-P

October 21 2010, 11:07 AM

 This message has been edited by burger2227 on Oct 21, 2010 11:08 AM

 Respond to this message