Qbasicnews.com
November 22, 2019, 06:48:47 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Make the BEST old fashioned game! BOMBERMAN, PACMAN, PONG...  (Read 2295 times)
mddwebboy
Member
*
Posts: 58


WWW
« on: June 20, 2004, 04:57:08 PM »

That's right: make the best old fashoined game you can think of!

PACKMAN (Keys: a, d, w, s; end with Q) (awesome engine)

Code:
DIM map(100, 100)
SCREEN 13

FOR yer = 0 TO 19
FOR xer = 0 TO 30
READ map(xer, yer)
NEXT xer
NEXT yer

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

mi = 7

d$ = "1"

sp = .99

FOR yer = 0 TO 19
FOR xer = 0 TO 30
d = map(xer, yer)
IF (d = 0) THEN
PSET ((xer * 10) + 5, (yer * 10) + 5), 1
ELSEIF (d = 4) THEN
CIRCLE ((xer * 10) + 5, (yer * 10) + 5), 2, INT(RND * 256)
ELSEIF (d = 1) THEN
LINE ((xer * 10) + 1, (yer * 10) + 1)-((xer * 10) + 9, (yer * 10) + 9), 2, BF
ELSEIF (d = 2) THEN
LINE ((xer * 10) + 1, (yer * 10) + 1)-((xer * 10) + 9, (yer * 10) + 9), 4, BF
FOR i = 2 TO mi
x(i) = (xer * 10) - 10
y(i) = (yer * 10)
NEXT i
ELSEIF (d = 3) THEN
x(1) = xer * 10
y(1) = yer * 10
map(xer, yer) = 0
END IF
NEXT xer
NEXT yer

FOR yer = 0 TO 7
FOR xer = 0 TO 7
READ ghost(xer, yer)
NEXT xer
NEXT yer

DATA 0,0,3,3,3,3,0,0
DATA 0,3,0,0,0,0,3,0
DATA 0,3,4,0,0,4,3,0
DATA 3,0,0,0,0,0,0,3
DATA 3,0,0,4,4,0,0,3
DATA 3,0,0,0,0,0,0,3
DATA 3,0,3,0,3,3,0,3
DATA 0,3,0,3,0,0,3,0

FOR i = 2 TO mi
g = INT(RND * 3) + 1
IF g = 1 THEN d$(i) = "1"
IF g = 2 THEN d$(i) = "2"
IF g = 3 THEN d$(i) = "3"
IF g = 4 THEN d$(i) = "4"
NEXT i

DO
Key$ = INKEY$
RANDOMIZE TIMER
FOR i = 1 TO mi

r = r + 1

IF (r > 4) THEN
END IF

olx(i) = x(i)
oly(i) = y(i)

yex = 0
yey = 0
h$ = "N"
FOR yer = 0 TO 19
FOR xer = 0 TO 30
d = map(xer, yer)
h$ = "N"
IF (d = 0) THEN
IF (x(1) + 5 > (xer * 10) AND x(1) + 5 < (xer * 10) + 10) THEN
IF (y(1) + 5 > (yer * 10) AND y(1) + 5 < (yer * 10) + 10) THEN
SCORE = SCORE + 1
map(xer, yer) = -1
END IF
END IF
ELSEIF (d = 4) THEN
IF (x(1) + 5 > (xer * 10) AND x(1) + 5 < (xer * 10) + 10) THEN
IF (y(1) + 5 > (yer * 10) AND y(1) + 5 < (yer * 10) + 10) THEN
SCORE = SCORE + 5
map(xer, yer) = -1
st = 60
st$ = "Y"
END IF
END IF
END IF
IF (d = 1 OR d = 2) THEN
IF (x(i) + 9 > (xer * 10) AND x(i) < (xer * 10) + 9 OR x(i) > 310 OR x(i) < 1) THEN
IF (y(i) + 9 > (yer * 10) AND y(i) < (yer * 10) + 9 OR y(i) > 190 OR y(i) < 1) THEN
h$ = "Y"
IF (h$ = "Y") THEN
IF (d$(i) = "1") THEN y(i) = y(i) + sp
IF (d$(i) = "2") THEN y(i) = y(i) - sp
IF (d$(i) = "3") THEN x(i) = x(i) + sp
IF (d$(i) = "4") THEN x(i) = x(i) - sp
IF (i = 1) THEN
d$(i) = ""
END IF
IF (i > 1) THEN
pd$(i) = d$(i)
xs(i) = 0
ys(i) = 0
DO
des = des + 1
g = INT(RND * 5)
IF g = 1 THEN d$(i) = "1"
IF g = 2 THEN d$(i) = "2"
IF g = 3 THEN d$(i) = "3"
IF g = 4 THEN d$(i) = "4"
IF (x(i) + 19 > (xer * 10) AND x(i) < (xer * 10) + 19 AND (yer * 10) AND y(i) < (yer * 10) + 9 OR y(i) > 200 OR y(i) < 1) THEN
ELSE
g = 4
END IF
LOOP UNTIL d$(i) <> pd$(i)
END IF
END IF
END IF
END IF
END IF
NEXT xer
NEXT yer

IF (d$(i) = "") THEN
xs(i) = 0
ys(i) = 0
END IF

x(i) = x(i) + xs(i)
y(i) = y(i) + ys(i)

IF (Key$ = "w") THEN
old$(1) = d$(1)
d$(1) = "1"
xs(1) = 0
ys(1) = 0
ELSEIF (Key$ = "s") THEN
old$(1) = d$(1)
d$(1) = "2"
xs(1) = 0
ys(1) = 0
ELSEIF (Key$ = "a") THEN
old$(1) = d$(1)
d$(1) = "3"
xs(1) = 0
ys(1) = 0
ELSEIF (Key$ = "d") THEN
old$(1) = d$(1)
d$(1) = "4"
xs(1) = 0
ys(1) = 0
END IF

IF (d$(i) = "1") THEN ys(i) = 0 - sp
IF (d$(i) = "2") THEN ys(i) = sp
IF (d$(i) = "3") THEN xs(i) = 0 - sp
IF (d$(i) = "4") THEN xs(i) = sp
IF (old$(i) = "1") THEN olys(i) = 0 - sp
IF (old$(i) = "2") THEN olys(i) = sp
IF (old$(i) = "3") THEN olxs(i) = 0 - sp
IF (old$(i) = "4") THEN olxs(i) = sp

IF (i = 1) THEN
IF (st > 0) THEN
CIRCLE (olx(i) + 5, oly(i) + 5), 4, 0
CIRCLE (x(i) + 5, y(i) + 5), 4, (INT(RND * 256))
ELSE
CIRCLE (olx(i) + 5, oly(i) + 5), 4, 0
CIRCLE (x(i) + 5, y(i) + 5), 4, 14
END IF
ELSEIF (i > 1) THEN
FOR yer = 0 TO 7
FOR xer = 0 TO 7
IF (ghost(xer, yer) <> 0) THEN
PSET (olx(i) + xer + 1, oly(i) + yer + 2), 0
PSET (x(i) + xer + 1, y(i) + yer + 2), ghost(xer, yer)
END IF
NEXT xer
NEXT yer
END IF

der$ = "N"
FOR yer = 0 TO 19
FOR xer = 0 TO 30
IF (map(xer, yer) = 4) THEN
CIRCLE ((xer * 10) + 5, (yer * 10) + 5), 2, INT(RND * 256)
END IF
IF (map(xer, yer) = 0) THEN
der$ = "Y"
IF (POINT((xer * 10) + 5, (yer * 10) + 5) <> 1) THEN
PSET ((xer * 10) + 5, (yer * 10) + 5), 1
END IF
END IF
NEXT xer
NEXT yer

'IF (map(INT(x(1) / 10), INT(y(1) / 10)) = 0 OR map(INT(x(1) / 10), INT((y(1) + 10) / 10)) = 0) THEN
'map(INT(x(1) / 10), INT(y(1) / 10)) = -1
'ELSEIF (map(INT(x(1) / 10), INT(y(1) / 10)) = 4 OR map(INT(x(1) / 10), INT((y(1) + 10) / 10)) = 0) THEN
'map(INT(x(1) / 10), INT(y(1) / 10)) = -1
'st$ = "Y"
'st = 60
'END IF

IF (st > 0) THEN
LOCATE 1, 39: PRINT CHR$(2)
LOCATE 2, 37: PRINT INT(st)
ELSE
LOCATE 1, 39: PRINT CHR$(1)
LOCATE 2, 37: PRINT INT(st); " "
END IF

LOCATE 4, 36: PRINT SCORE

IF (st > 0) THEN
st = st - .03
ELSE
st = 0
st$ = "N"
END IF

NEXT i

IF (der$ = "N") THEN Key$ = "q"

FOR i = 2 TO mi
IF (x(1) + 5 > x(i) AND x(1) < x(i) + 10) THEN
IF (y(1) + 5 > y(i) AND y(1) < y(i) + 10) THEN
IF (st = 0) THEN
Key$ = "q"
ELSEIF (st > 0) THEN
SCORE = SCORE + 10
FOR yer = 0 TO 19
FOR xer = 0 TO 30
d = map(xer, yer)
IF (d = 2) THEN
x(i) = (xer * 10) - 10
y(i) = (yer * 10)
END IF
NEXT xer
NEXT yer
END IF
END IF
END IF
NEXT i

LOOP UNTIL Key$ = "q"

IF (der$ <> "N") THEN
FOR sou = 3000 TO 1000 STEP -25
SOUND sou, .4
NEXT sou
END IF



Another example:

Code:
DIM starx(1000)
DIM stary(1000)
DIM starz(1000)
DIM starc(1000)

DO
Key$ = INKEY$
LOCATE 1, 1: PRINT "Press the up key you want for this pong game."

upk$ = Key$
LOOP UNTIL Key$ <> ""

DO
Key$ = INKEY$
LOCATE 1, 1: PRINT "Press the down key you want for this pong game."

dnk$ = Key$
LOOP UNTIL Key$ <> ""

SCREEN 13

speed = 1

starnum = 50

bxs = 1.5
bys = 1

bx = 160
by = 100

x = 5
y = 100

xs = 0
ys = 0

dert(1) = 0
dert(2) = 5
dert(3) = 10

pc = 2

size = 45

FOR th = 1 TO starnum
starx(th) = (INT(RND * 320))
stary(th) = (INT(RND * 200))
starz(th) = (RND * 1)
starc(th) = (INT(RND * 5)) + 25
NEXT th

DO
Key$ = INKEY$

'51 --> 56

FOR th = 1 TO starnum
FOR der = 1 TO (starz(th) * 4) + 1
CIRCLE (rix + (starx(th) * (starz(th) - 0)), riy + (stary(th) * (starz(th) - 0))), der, 0
NEXT der
riy2 = 100 - ((starz(th) - .02) * 100)
rix2 = 160 - ((starz(th) - .02) * 160)
riy = 100 - (starz(th) * 100)
rix = 160 - (starz(th) * 160)
olsx = starx(th)
olsy = stary(th)
IF (starz(th) < 1) THEN
starz(th) = starz(th) + (speed / 100000)
ELSE
FOR dere = 0 TO 2
FOR der = 1 TO 5
CIRCLE (rix + (starx(th) * starz(th)), riy + (stary(th) * starz(th))), der, 0
NEXT der
NEXT dere
starz(th) = 0
starx(th) = (INT(RND * 320))
stary(th) = (INT(RND * 200))
END IF
FOR der = (starz(th) * 4) TO (starz(th) * 4) + 1
CIRCLE (rix + (starx(th) * starz(th)), riy + (stary(th) * starz(th))), der, 0
NEXT der
FOR der = 1 TO (starz(th) * 4) + 2
CIRCLE (rix2 + (starx(th) * (starz(th) - .02)), riy2 + (stary(th) * (starz(th) - .02))), der, 0
NEXT der
FOR der = 1 TO (starz(th) * 4)
CIRCLE (rix + (starx(th) * starz(th)), riy + (stary(th) * starz(th))), der, starc(th)
NEXT der
NEXT th


LOCATE 1, 1: PRINT INT(speed); "<--speed."

IF (Key$ = upk$) THEN
ys = ys - .5
ELSEIF (Key$ = dnk$) THEN
ys = ys + .5
END IF

oly = y
olx = x

x = x + xs
y = y + ys

IF (ys > 0) THEN
ys = ys - .05
ELSEIF (ys < 0) THEN
ys = ys + .05
END IF

IF (y > 200 - (size + 7)) THEN
ys = 20 - 20 - ys / 2
y = 200 - (size + 7)
ELSEIF (y < 7) THEN
ys = 0 - ys / 2
y = 7
END IF

'********************************************************>**>*>*>>>>>

IF (bx >= 160) THEN
IF (bxs > 0) THEN
bxs = bxs - .01
ELSEIF (bxs <= 0) THEN
bxs = bxs - .0167
END IF
ELSEIF (bx <= 25 AND bx > 23) THEN
IF (by >= (y - 10) AND (y + size + 10) >= by) THEN
bxs = 20 - 20 - bxs
IF (bxs > 1.7) THEN
bxs = 1.7
END IF
IF (bxs < 1) THEN
bxs = 1
END IF
IF (bys < 3 AND bys > -3) THEN
bys = bys + (ys / 1.5)
ELSE
bys = bys / 2
END IF
END IF
ELSEIF (bx <= 23 AND bx >= 1) THEN
IF (by >= y AND by <= (y + size)) THEN
bxs = .75
IF (bys < 3 AND bys > -3) THEN
bys = ys
ELSE
bys = bys / 2
END IF
END IF
END IF

IF (by > 193) THEN
bys = 0 - bys
ELSEIF (by < 7) THEN
bys = 20 - 20 - bys
END IF

IF (by > 150) THEN
bys = bys - .13
ELSEIF (by < 50) THEN
bys = bys + .13
END IF

box = bx
boy = by

bx = bx + bxs
by = by + bys

FOR we = 0 TO 16
LINE ((olx + we), (oly - 8))-((olx + we), 8 + (oly + size)), 0
NEXT we

FOR lin = 1 TO 10
LINE ((x + 2 + lin), (y + 2))-((x + 2 + lin), y + (size - 5)), lin + 18
NEXT lin

FOR cir = 0 TO 7
IF (cir > 1) THEN
CIRCLE ((x + 7), y), cir, (27 - cir)
ELSE
CIRCLE ((x + 7), y), cir, 6
END IF
NEXT cir

FOR cir = 0 TO 7
IF (cir > 1) THEN
CIRCLE ((x + 7), (y + size)), cir, (27 - cir)
ELSE
CIRCLE ((x + 7), (y + size)), cir, 6
END IF
NEXT cir

IF (speed < 20) THEN
speed = speed + .03
ELSEIF (speed >= 120) THEN
speed = speed + .5
ELSEIF (speed >= 20) THEN
speed = speed + .1
END IF

'*********************************************************
FOR dw = 1 TO 12
CIRCLE (box, boy), dw, 0
NEXT dw

FOR dw = 1 TO 12 STEP 2
CIRCLE (bx, by), dw, (INT(RND * 3)) + 53
NEXT dw

CIRCLE (box, boy), try, 0

try = try + .5

CIRCLE (bx, by), try, (INT(RND * 16))

IF (try > 20) THEN
CIRCLE (bx, by), try, 0
try = 0
END IF

FOR dw = 1 TO 7
rt = (INT(RND * 3000))
IF (rt > 2500) THEN
ELSE
CIRCLE (bx, by), dw, 28 - dw
END IF
NEXT dw
'*********************************************************

IF (speed >= 3000) THEN
Key$ = "q"
CLS
FOR ty = 1 TO 320
FOR tyt = 1 TO 200
PSET (ty, tyt), (INT(RND * 256))
NEXT tyt
NEXT ty
PRINT "You won!"
DO
LOCATE 1, 1: PRINT "Press Q to end the game."
LOOP UNTIL INKEY$ = "q"
END IF

'Daaaaaaaaaaaaa BBBBBBBBBBOOOOOOOOOOOOOOOOOOOOSSSSSSSSSTTTTTTERRRRRRRRSSSSSS
FOR yo = 1 TO 3
old(yo) = dert(yo)
dert(yo) = dert(yo) + .32 + (speed / 5000)

CIRCLE (derx(yo), dery(yo)), old(yo), 0
CIRCLE (derx(yo), (dery(yo) + size)), old(yo), 0

CIRCLE (derx(yo), dery(yo)), dert(yo), (INT(RND * 16))
CIRCLE (derx(yo), (dery(yo) + size)), dert(yo), (INT(RND * 16))

IF (dert(yo) > 15) THEN
CIRCLE (derx(yo), dery(yo)), dert(yo), 0
CIRCLE (derx(yo), (dery(yo) + size)), dert(yo), 0
dert(yo) = 0
dery(yo) = y
derx(yo) = (x + 7)
END IF

NEXT yo

FOR dela = 1 TO 10 * (3000 - INT(speed))
PSET (1, 1), 1
NEXT dela

IF (bx < -7) THEN
Key$ = "q"
END IF

LOOP UNTIL Key$ = "q"




SO GET TO IT!!!

 :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:  :rotfl:
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!