Oh man! What a day! I found a game called Higher ground by user:IBOL from chair in the 20 line code forum and I've been playing around with it (I hope the author doesn't mind!)
The game's brilliance is its simplicity! If you die, you know its because you misjudged something; it was your lack of skill that killed you! I haven't even changed the way the character jumps; the straight up, straight down movement has a certain charm. I even like the black cube "sentry droids". Wicked game!
Well, here it is. This is what I've reduced* it to. It takes ages to load cos I'm drawing all the graphics with db drawing tools. It might be a good idea to save the images the first time round so it doesnt take so long next time...
anyway, here it is!
randomize timer():set ambient light 80
#constant screenw 800 : #constant screenh 600
set display mode screenw,screenh,32
sync on
sync rate 30
sync
global move as float
set text font "Bauhaus"
set text size 20
set text to bolditalic
cls rgb(100,200,240) : shadCentreText(400,300,"Loading")
sync
create bitmap 1,screenw,screenh : for x=0 to (screenw/8) : for y=0 to (screenh/8) : z=rnd(128) : rndr=rnd(48):rndg=rnd(48):rndb=rnd(48):for i = 1 to 8 :ink rgb(z+rndr+i*10,z+rndg+i*10,z+rndb+i*10),0 : filledCircle( (x*8)+i,(y*8)+i,8) : next i : next y : next x : get image 3000,0,0,screen width(),screen height() : sprite 2,screen width(),screen height(),3000 : set sprite alpha 2,32 : delete bitmap 1
cls rgb(100,200,240) : paste sprite 2,0,0 : shadCentreText(400,300,"Loading") : sync
`hide mouse
make object SPHERE 1,5
create bitmap 1,257,257
ink rgb(255,0,0),0
box 0,0,256,256
ink rgb(255,255,0),0
box 128-32,0,128+32,256 : paste sprite 2,0,0
get image 5,0,0,256,256 : delete bitmap 1 : texture object 1,5 : make light 1
start_game: do :cls rgb(100,200,240) : paste sprite 2,0,0 : shadCentreText(400,10,"HIGHER GROUND") : shadCentreText(400,40,"(press Shift key to play)") : shadCentreText(400,100,"MOVE") : shadCentreText(400,130,"forward and back with the UP and DOWN arrow keys.") : shadCentreText(400,160,"TURN") : shadCentreText(400,190,"left and right with the LEFT and RIGHT arrow keys.") : shadCentreText(400,220,"JUMP") : shadCentreText(400,250,"with the SHIFT key") : life=3 : score=0 : falling=0 : ouch=0 : level=0 : hite=55 : nme=2
shadCentreText(400,280,"COLLECT") : shadCentreText(400,310,"the coloured spheres from the tops of buildings.") : shadCentreText(400,340,"SCORE") : shadCentreText(400,370,"more points for higher spheres.") : shadCentreText(400,400,"AVOID") : shadCentreText(400,430,"the black cube sentries.") : shadCentreText(400,460,"DON'T") : shadCentreText(400,490,"fall too far.") : shadCentreText(400,520,"PROCEED") : shadCentreText(400,550,"to the next level by pressing any 'number' key.") : if shiftkey() : cls rgb(100,200,240) : paste sprite 2,0,0 : shadCentreText(400,300,"Loading") : sync : exit : endif : SYNC : loop
start_new_level: make object box 300,10,10,10 : set object collision on 300: inc level : nme=nme+4 : for t=2 to 1999 : if object exist (t) : delete object t : endif : next t : create bitmap 1,512,512 : ink rgb(0,0,255),0 : box 0,0,512,256 : for t = 1 to 127 : ink rgb(t*2,t*2,255),0 : box 0,128+t,512,129+t : next t : ink rgb(32,200,32),0: box 0,256,512,512:ink rgb(255,255,255),0 : for t = 1 to 512 : x=rnd(484)+15 : y=rnd(228)+15 : filledCircle(x,y,(rnd(5)+5)) : next t : blur bitmap 1,3: paste sprite 2,0,0 : get image 1,0,0,512,512 : delete bitmap 1 : make object sphere 999,1600 : set object cull 999,0 : set object light 999,0 : set object collision off 999 : texture object 999,1
create bitmap 1,256,256 : x=rnd(50)+200 : ink rgb(x,x,0),0 : box 0,0,256,256 : for t=1 to 5 : x=rnd(100)+10 : ink rgb(x,x,0),0 : y=rnd(256) : z=rnd(256) : box y,z,y+3+rnd(2),z+3+rnd(2) : next t : for t=0 to 256 step 4 : x=rnd(200)+50 : ink rgb(x,x,0),0 : y=rnd(2)+1 : box 0,t,256,t+y : next t : get image 2,0,0,64,64 : delete bitmap 1
if matrix exist(1) : delete matrix 1 : endif : create bitmap 1,256,256 : ink rgb(0,223,0),0 : box 0,0,256,256 : paste sprite 2,0,0 : get image 3,0,0,256,256 : delete bitmap 1 : make matrix 1,800,800,15,15 : prepare matrix texture 1,3,1,1 : fill matrix 1,0,1 : POSITION MATRIX 1,-200,0,-200 : update matrix 1 : dim x(10) as float : dim y(10) as float : dim z(10) as float :
numobj=99 : create bitmap 1,128,128 : for x=1 to 20 : for y=1 to 20 : if rnd(2)=1 : inc numobj : make object box numobj+320,20,1,20 : color object numobj+320,rgb(rnd(128)+64,rnd(128)+64,rnd(128)+64): boxhite=rnd(hite)+5 : make object box numobj,20,boxhite-1,20 : texture object numobj,2 : position object numobj,x*20,(object size y(numobj)/2),y*20 : position object numobj+320,object position x(numobj),boxhite,object position z(numobj) : make object sphere numobj+1000,5 : position object numobj+1000,x*20,object size y(numobj)+5,y*20 : colour=rgb(rnd(128)+117,rnd(128)+117,rnd(128)+117) : ink colour,0 : box 0,0,128,128 : for i= 1 to 32 : ink rgb(rgbr(colour)-10,rgbg(colour)-10,rgbb(colour)-10),0 : filledCircle(rnd(128),rnd(128),8):ink rgb(rgbr(colour)+10,rgbg(colour)+10,rgbb(colour)+10),0 : filledCircle(rnd(128),rnd(128),8): next i : sprite 1,0,0,2 : set sprite alpha 1,64 : paste sprite 1,0,0 : paste sprite 2,0,0 : delete sprite 1 : get image 30+numobj,0,0,64,64 : texture object numobj+1000,30+numobj : texture object numobj,30+numobj : endif : next y : next x : delete bitmap 1 : a=numobj+1 : make object box a,19,hite+15,19 : position object a,200,(hite+15)/2,200 : texture object a,2 : a=numobj+1111 : make object sphere a,10 : position object a,200,(hite+20),200 : texture object a,5
create bitmap 1,4,4 : ink rgb(0,0,0),0 : box 0,0,3,3 : get image 4,0,0,3,3 : delete bitmap 1 : for t=10 to 9+nme : make object cube t,6 : rotate object t,0,45,0 : fix object pivot t : texture object t,4 : next t : for t=2 to 9 : make object sphere t,5 : texture object t,5 : scale object t,(10-t)*11,(10-t)*11,(10-t)*11 : set object collision off t : position object t,-999.9,-999.9,-999.9 : x(t)=-999.9 : y(t)=-999.9 : z(t)=-999.9 : next t
start_this_level: : ink rgb(255,0,100),0 : repeat : position object 1,rnd(300)+100,0,rnd(300)+100 : until object collision (1,0)=0 : j=20 : bonus=0 : for t=10 to 9+nme : q=t : repeat : gosub place_enemy : until object collision (q,0)=0 : next t
global oldx as float:global oldy as float:global oldz as float
do
oldx = object position x(1):oldy=object position y(1):oldz=object position z(1)
for t=100 to 400 : if object exist(t) : if intersect object(t,object position x(1),object position y(1),object position z(1),camera position x(),camera position y(),camera position z()) : ghost object on t,2 : else : ghost object off t : endif : endif : if object exist(t+320) : if intersect object(t+320,object position x(1),object position y(1),object position z(1),camera position x(),camera position y(),camera position z()) : ghost object on t+320,2 : else : ghost object off t+320 : endif : endif : next t
for t=1100 to 1111+numobj : if object exist (t) : set object collision off t : endif : next t
if ouch<30 : if upkey() : move=move+0.2 : endif : if downkey() : move=move-0.2 : endif : if rightkey() : yrotate object 1,object angle y(1)+9 : endif : if leftkey() : yrotate object 1,object angle y(1)-9 : endif
if move > 0 : move=move-0.1 : endif : if move < 0 : move=move+0.1 : endif : if move > 0 and move < 0.1 : move = 0 : endif : if move < 0 and move > -0.1 : move = 0 : endif : if move > 2 : move = 1 : endif : if move < -2 : move = -1 : endif : endif
c=0 : y=object position y(1) : move object down 1,1 : x=object collision(1,0) : if x>99 : move object up 1,1 : endif : if object position y(1)<1 : move object up 1,1 : endif : yy=object position y(1) : if abs(yy-y)>10 : position object 1,object position x(1),y,object position z(1) : endif : move object 1,move*1.5 : x=object collision(1,0) : if x>99 : move object 1,-move*1.5 : endif
falling=0 :if object position y(1)>3 : move object down 1,1 : if object collision (1,0)=0 : falling=1 : endif : move object up 1,1 : endif : dec j : if j<0 : if j<-20 : if falling=0 : if shiftkey() : j=20 : endif : endif : endif : else : move object up 1,2 : endif
for t=1100 to 1111+numobj : if object exist (t) : set object collision on t : endif : next t : x=object collision (1,0) : if x>999 : score=score+object position y(x) + bonus : inc bonus : if x=1111+numobj : if life<3 : inc life : else bonus=bonus+20 : endif : endif : delete object x : endif : if x>5 and x<99 : ouch=99 : endif
if falling=1 and j<-20 : dec score : inc ouch : endif : if ouch>30 : if falling=0 : dec life : ouch=0 : for t=100 to 5 step -3 : scale object 1,(110-t)*6,t,(110-t)*6 : sync : next t : wait 1000 : scale object 1,100,100,100 : if life>0 : goto start_this_level : else : gosub end_game : goto start_game : endif : endif : endif : if falling=0 : ouch=0 : endif
for t=10 to 9+nme
up=0 : move object t,1 : forward=1
if object collision (t,0)>70 : move object t,-1 : forward=0 : up=1 : endif
if up=0 : if object position y(t)>3 : move object down t,1 : if object collision(t,0)<70 : up=-1 : endif
move object up t,1 : endif : endif
if up=-1 and forward=1 : move object t,-1 : endif
move object up t,up : x=object position x(t) : z=object position z(t) : if x<0 or x>400 or z<0 or z>400 : point object t,200,object position y(t),200 : yrotate object t,object angle y(t)+rnd(120)-60 : endif
next t
yrotate object 2,object angle y(1)
if object position x(1)=oldx and object position y(1)=oldy and object position z(1)=oldz
for t=8 to 2 step -1 : y(t+1)=y(t) : next t
else
for t=8 to 2 step -1 : yrotate object t+1,object angle y(t) : x(t+1)=x(t) : y(t+1)=y(t) : z(t+1)=z(t) : next t
endif
x(2)=object position x(1) : y(2)=object position y(1) : z(2)=object position z(1) : for t=2 to 9 : position object t,x(t),y(t),z(t) : next t
shadText( 2,12,"level: "+STR$(level)) : shadText( 2,32,"score: "+STR$(score)) : shadText( 2,52,"bonus: "+STR$(bonus)) :shadText( 2,72,"lives: "+STR$(life))
set camera to follow 0,object position x(1),object position y(1),object position z(1),object angle y(1),25,10,5,0 : position object 999,object position x(1),object position y(1),object position z(1) : position light 1,object position x(1),object position y(1),object position z(1) : if j<-20 and ouch=0 and falling=0 : if val(inkey$())>0 : hite=hite+10 : goto start_new_level : endif : endif : sync : loop
place_enemy: : a=rnd(3) : restore : for b=0 to a : read x,z : next b : if x=-1 : x=rnd(400) :endif: if z=-1 : z=rnd(400) :endif: position object q,x,3,z : point object q,0,3,0 : yrotate object q,object angle y(t)+rnd(120)-60 : return
end_game: : shadCentreText(400,10,"HIGHER GROUND") : shadCentreText(400,40,"AstrumGames.com") : shadCentreText(400,90,"Additional code") : shadCentreText(400,120,"Nicholas.John.Joseph.Taylor@gmail.com") : shadCentreText(400,190,"Your Final Score") : shadCentreText(400,220,str$(score)) : shadCentreText(400,250,"press any key to play again") : shadCentreText(400,280,"or [ESC] to quit.") : SYNC : wait key : return : data 0,-1,400,-1,-1,0,-1,400
function FilledCircle( CX as integer, CY as integer, R as integer )
`credit for this function goes to IanM! Its from the codebase
local x as integer
local y as integer
local i as integer
local s as integer
` Precalculate the square of the radius - this is the hypotenuse
i=R*R
` Calculate the size of the central square
s=R*0.70710678 : ` this number is sin(45)
` Draw it
box CX-s, CY-s, CX+s+1, CY+s+1
s=s+1
` Loop through the bit we have not yet drawn
for y=s to R
x=sqrt( i-(y*y) )
` Draw top and bottom
box CX-x, CY-y, CX+x+1, CY-y+1
box CX-x, CY+y, CX+x+1, CY+y+1
` Draw left and right
box CX-y, CY-x, CX-y+1, CY+x+1
box CX+y, CY-x, CX+y+1, CY+x+1
next y
endfunction
function shadCentreText(stx,sty,st$)
ink 0,0
center text stx,sty,st$
ink rgb(128,128,128),0
center text stx+1,sty+1,st$
ink rgb(255,255,255),0
center text stx+2,sty+2,st$
endfunction
function shadText(stx,sty,st$)
ink 0,0
text stx+2,sty+2,st$
ink rgb(128,128,128),0
text stx+1,sty+1,st$
ink rgb(255,255,255),0
text stx,sty,st$
endfunction
Ive done quite a bit.
- movement of the worm is more like a caterpillar
- lots of colours and generated textures (whilst retaining the "no media" theme)
- a ghost effect has been used when walls get in the way of the camera
- I used a fillcircle command from the codebase section to help with the drawing too!
Hope you like it IBOL. It won't stop here. I have the bug! I'm currently toying with dynamic objects so look out for higher ground with nice objects too + i will implement the save image feature to speed up loading too!
peace
ps. here is the original game
http://forum.thegamecreators.com/?m=forum_view&t=52821&b=11
pps. im using the darkbasic 6 beta. I just tried it on the original darkbasic and its runs hilariously bad after making -move, 0-move!
* by "reduced" I mean my that I've reduced it a lower being. I don't mean that I have reduced the number of lines or optimised it in any way. Sorry
Nicholas John Joseph Taylor; Nick
[url]http://www.thesaturdaychannel.co.uk [/url]