Hey peeps.
Over the past few weeks I've been working on this little game.
The aim is to use stealth, cunning and a Desert Eagle to reach the end of each level.
It includes a story line as well; though it's not finished as such. I've just decided that it's time to move on and work on another, more important project.
However, I've included the editor and a text file that shows you what data is required to make levels for the game. (think I forgot to add in there that you hit the spacebar in the editor to save your level to the clipboard; from there you have to paste the data into a text file.)
So, enjoy it, modify it(make your own game?) and whatever.
sync on : sync rate 45 : autocam off : xrotate camera 60 : set camera range 10, 200 : color backdrop 1 : fog on : fog distance 300 : hide mouse : set ambient light 100 : set text font "Arial" : set text size 16 : for a = 1 to 22 : if file exist("data\"+str$(a)+".jpg") : load image "data\"+str$(a)+".jpg",a,1 : else : load image "data\"+str$(a)+".png",a,1 : endif : next a : load object "data\sprite.dbo", 1 : texture object 1, 9 : set object transparency 1, 1 : sc_SetupObject 1,0,2 : sc_updateobject 1 : p_mhp = 70
p_hp = 70 : dim weapon(3,3) : weapon(1,2)=5 : weapon(1,3)=3 : weapon(2,2)=3 : weapon(3,2)=10 : weapon(3,3)=10 : current_weapon = 1 : current_weapon_name$ = "Desert Eagle - Pistol" : dim enemy(0,0) : do : ending = 0 : level = level + 1 : backdrop off : if dead = 0 : open to read 1, "lvl\"+str$(level)+"_story.txt" : else : open to read 1, "lvl\die_story.txt" : endif : sync : repeat : read string 1, com$ : if com$ = "image" : read string 1, com$ : image_number = val(com$)
endif : if com$ = "wait" : read string 1, com$ : wait val(com$) : endif : if com$ = "end" : end : endif : if com$ = com$ : cls : if image_number > 0 : if image exist(image_number) : paste image image_number, (400)-image width(image_number)/2, (300)-image height(image_number)/2 : endif : endif : text 25, screen height()-100, wraptext(com$, 750) : text screen width() - 100, screen height() - 20, "<press any key>" : sync : wait key : endif : until file end(1) : close file 1 : backdrop on : dim level_stats(10) as dword : open to read 1, "lvl\"+str$(level)+"_level_stats.txt"
for a = 1 to 10 : read string 1, nul$ : level_stats(a) = val(nul$) : next a : close file 1 : size = sqrt(FILE SIZE("lvl\"+str$(level)+"_level.txt")) : dim levelcol(size+1,size+1) : b_obj = 200 : x = 0 : y = size : enemy(0,0) = 0 : dim enemy(enemy(0,0),7) : open to read 1, "lvl\"+str$(level)+"_level.txt" : repeat : read byte 1, com : f = 0 : m = 0 : c = 0 : c_up = 0 : b_obj = b_obj + 1 : x = x + 1 : if x = size+1 : x = 1 : y = y - 1 : endif
levelcol(x,y) = 0 : if chr$(com) = "s" : position object 1, x*10, 0, y*10 : f = 1 : endif : if chr$(com) = "e" : end_x = x*10 : end_y = y*10 : make object cube b_obj, 10 : texture object b_obj, 6 : levelcol(x,y) = 1 : endif : if chr$(com) = " " : c = 1 : endif : if chr$(com) = "." : f = 1 : endif : if chr$(com) = "M" : m = 1 : endif : if chr$(com) = "," : make object box b_obj, 10, 1, 10 : texture object b_obj, 7 : move object up b_obj, -5.00
f = 1 : endif : if chr$(com) = "_" : make object box b_obj, 10, 1, 10 : texture object b_obj, 15 : move object up b_obj, -5.00 : m = 1 : endif : if chr$(com) = "w" : make object box b_obj, 10, 25, 10 : texture object b_obj, 2 : move object up b_obj, -2.5 : col_object = b_obj : levelcol(x,y) = 1 : endif : if chr$(com) = "m" : make object box b_obj, 10,10,10 : texture object b_obj, 3 : col_object = b_obj : f=1 : c=1 : endif : if chr$(com) = "t" : load object "data\tree.dbo", b_obj : yrotate object b_obj, rnd(360)
texture object b_obj, 16 : set object transparency b_obj, 1 : scale object b_obj, 130,150,130 : position object b_obj, x*10, 3, y*10 : c_up = 3 : m=1 : c=1 : endif : if chr$(com) = "W" : make object plain b_obj, 10, 10 : texture object b_obj, 5 : xrotate object b_obj, 270 : ghost object on b_obj, 3 : position object b_obj, x*10, -8, y*10 : c=1 : endif : if chr$(com) = "g" : make object cube b_obj, 3 : texture object b_obj, 13 : gun_obj = b_obj : gun_x = x*10 : gun_y = y*10 : f = 1 : endif : if chr$(com) = "b"
inc enemy(0,0) : dim enemy(enemy(0,0),10) : enemy(enemy(0,0),1)=b_obj : enemy(enemy(0,0),2) = x*10 : enemy(enemy(0,0),3) = y*10 : enemy(enemy(0,0),4) = level_stats(5) : enemy(enemy(0,0),5) = level_stats(6) : enemy(enemy(0,0),8) = level_stats(7) : enemy(enemy(0,0),9) = level_stats(8) : enemy(enemy(0,0),10) = level_stats(9) : load object "data\sprite.dbo", b_obj : texture object b_obj, level_stats(3) : set object transparency b_obj, 1 : move object up b_obj, level_stats(4) : scale object b_obj, 100+(10*level_stats(4)), 100+(10*level_stats(4)), 100+(10*level_stats(4)) : sc_SetupObject b_obj,0,2 : sc_updateobject b_obj : f = 1 : endif : if object exist(b_obj) : position object b_obj, x*10, object position y(b_obj), y*10 : endif : if f = 1 : b_obj = b_obj + 1 : make object cube b_obj, 10
texture object b_obj, 4 : position object b_obj, x*10, -10, y*10 : endif : if m = 1 : b_obj = b_obj + 1 : make object cube b_obj, 10 : texture object b_obj, 18 : position object b_obj, x*10, -10, y*10 : endif : if c = 1 : b_obj = b_obj + 1 : make object box b_obj, 11,10,11 : hide object b_obj : position object b_obj, x*10, 0-4+c_up, y*10 : sc_SetupObject b_obj,0,0 : sc_updateobject b_obj : levelcol(x,y) = 1 : endif : if col_object > 0 : if levelcol(x,y) = 1 : sc_SetupObject col_object,0,0 : sc_updateobject col_object : col_object = 0 : endif : endif
until file end(1) : close file 1 : repeat : x1#=object position x(1) : z1#=object position z(1) : if upkey() : yrotate object 1, 0 : move object 1, 0.7 : endif : if downkey() : yrotate object 1, 180 : move object 1, 0.7 : endif : if leftkey() : yrotate object 1, 270 : move object 1, 0.7 : endif : if rightkey() : yrotate object 1, 90 : move object 1, 0.7 : endif : if sc_SphereSlide(0,X1#,object position y(1),Z1#,object position x(1),object position y(1),object position z(1),object size(1)/2,1) > 0 : position object 1, sc_getCollisionSlideX(), sc_getCollisionSlideY(), sc_getCollisionSlideZ() : endif : sc_updateobject 1
position camera object position x(1), 60, object position z(1)-35 : if keystate(2) : current_weapon = 1 : current_weapon_name$ = "Desert Eagle - Pistol" : endif : if keystate(3) : current_weapon = 2 : current_weapon_name$ = "MSP - Silent Pistol" : endif : if keystate(4) : current_weapon = 3 : current_weapon_name$ = "M107 Sniper Rifle" : endif : shot_object = 0 : shot = 0 : if mouseclick() = 1 : if mouse_down = 0 : if weapon(current_weapon,1) > 0 : shot = 1 : line mousex(), mousey(), object screen x(1), object screen y(1) : shot_object = pick object(mousex(), mousey(), 201, b_obj) : weapon(current_weapon,1) = weapon(current_weapon,1) - 1 : endif : endif : mouse_down = 1
else : mouse_down = 0 : endif : if enemy(0,0) > 0 : for ai = 1 to enemy(0,0) : if enemy(ai,1) = shot_object : null = sc_intersectObject ( 0, object position x(enemy(ai,1)), Object Position Y(enemy(ai,1))+2, Object Position Z(enemy(ai,1)), Object Position X(1), Object Position Y(1)+2, Object Position Z(1)) : if sc_getObjectHit() = 1 : enemy(ai,4) = enemy(ai,4) - weapon(current_weapon,2) : alert_on = 1 : alert_left = alert_left + 200 : endif : endif : if enemy(ai,4) > 0 : center text object screen x(enemy(ai,1)), object screen y(enemy(ai,1))-30, str$(enemy(ai,4))+"/"+str$(level_stats(5)) : if ( object position x(enemy(ai,1))-object position x(1) )^2+( object position y(enemy(ai,1))-object position y(1) )^2+( object position z(enemy(ai,1))-object position z(1) )^2 < (enemy(ai,10)^2) + (shot*(10*weapon(current_weapon, 3))) : if mouseclick() = 2 : if rmouse_down = 0 : if ( object position x(enemy(ai,1))-object position x(1) )^2+( object position y(enemy(ai,1))-object position y(1) )^2+( object position z(enemy(ai,1))-object position z(1) )^2 < (10^2) : enemy(ai,4) = enemy(ai,4) - 1 : enemy(ai,2) = int(((object position x(1)+5)/10))*10 : enemy(ai,3) = int(((object position z(1)+5)/10))*10 : endif : rmouse_down = 1 : else
rmouse_down = 0 : endif : else : endif : Y#=wrapvalue(object angle y(enemy(ai,1))) : point object enemy(ai,1), object position x(1), object position y(1), object position z(1) : if int(Y#) < int(wrapvalue(object angle y(enemy(ai,1))))+60+(90*alert_on) : if int(Y#+60+(90*alert_on)) > int(wrapvalue(object angle y(enemy(ai,1))+60+(90*alert_on)))-60-(90*alert_on) : null = sc_intersectObject ( 0, object position x(enemy(ai,1)), Object Position Y(enemy(ai,1))+2, Object Position Z(enemy(ai,1)), Object Position X(1), Object Position Y(1)+2, Object Position Z(1)) : if sc_getObjectHit() = 1 : alert_on = 1 : alert_left = 999 : enemy(ai,2) = int(((object position x(1)+5)/10))*10 : enemy(ai,3) = int(((object position z(1)+5)/10))*10 : if enemy(ai,9) = 0 : enemy(ai,9) = level_stats(7) : line object screen x(enemy(ai,1)), object screen y(enemy(ai,1)), object screen x(1), object screen y(1) : p_hp = p_hp - enemy(ai,5) : endif : dec enemy(ai,9) : endif : endif : endif : endif : yrotate object enemy(ai,1), y#
moved = 0 : if int(object position x(enemy(ai,1))) <> int(enemy(ai,2)) : if int(object position z(enemy(ai,1))) <> int(enemy(ai,3)) : moved = 1 : x1#=object position x(enemy(ai,1)) : z1#=object position z(enemy(ai,1)) : point object enemy(ai,1), enemy(ai,2), object position y(enemy(ai,1)), enemy(ai,3) : move object enemy(ai,1), 0.1+(alert_on*0.2) : if sc_SphereSlide(0,X1#,object position y(enemy(ai,1)),Z1#,object position x(enemy(ai,1)),object position y(enemy(ai,1)),object position z(enemy(ai,1)),object size(enemy(ai,1))/2,enemy(ai,1)) > 0 : position object enemy(ai,1), sc_getCollisionSlideX(), sc_getCollisionSlideY(), sc_getCollisionSlideZ() : endif : sc_updateobject enemy(ai,1) : endif : endif : if moved = 0 : enemy(ai,6) = wrapvalue((enemy(ai,6) + (-1+rnd(2)))*90)/90 : if enemy(ai,6) = 0 : if levelcol((enemy(ai,2)/10)-1,(enemy(ai,3)/10)) = 0 : enemy(ai,2) = enemy(ai,2) - 10 : endif : endif : if enemy(ai,6) = 1 : if levelcol((enemy(ai,2)/10),(enemy(ai,3)/10)+1) = 0 : enemy(ai,3) = enemy(ai,3) + 10 : endif
endif : if enemy(ai,6) = 2 : if levelcol((enemy(ai,2)/10)+1,(enemy(ai,3)/10)) = 0 : enemy(ai,2) = enemy(ai,2) + 10 : endif : endif : if enemy(ai,6) = 3 : if levelcol((enemy(ai,2)/10),(enemy(ai,3)/10)-1) = 0 : enemy(ai,3) = enemy(ai,3) - 10 : endif : endif : x1#=object position x(enemy(ai,1)) : z1#=object position z(enemy(ai,1)) : point object enemy(ai,1), enemy(ai,2), object position y(enemy(ai,1)), enemy(ai,3) : move object enemy(ai,1), 0.2+(alert_on*0.2) : if sc_SphereSlide(0,X1#,object position y(enemy(ai,1)),Z1#,object position x(enemy(ai,1)),object position y(enemy(ai,1)),object position z(enemy(ai,1)),object size(enemy(ai,1))/2,enemy(ai,1)) > 0 : position object enemy(ai,1), sc_getCollisionSlideX(), sc_getCollisionSlideY(), sc_getCollisionSlideZ() : endif : sc_updateobject enemy(ai,1) : endif : else : move object down enemy(ai,1), 0.5 : if SC_collisionStatus(enemy(ai,1)) = 1 : SC_removeObject enemy(ai,1) : endif
endif : next ai : endif : if alert_left > 0 : dec alert_left : if alert_left > 1000 : alert_left = 1000 : endif : else : alert_on = 0 : endif : if object position x(1)> end_x - 7 : if object position x(1)< end_x + 7 : if object position z(1)> end_y - 7 : if object position z(1)< end_y + 7 : ending = 1 : endif : endif : endif : endif : if gun_obj > 0 : if object exist(gun_obj) : turn object right gun_obj, 1 : if object position x(1)> gun_x - 6 : if object position x(1)< gun_x + 6
if object position z(1)> gun_y - 6 : if object position z(1)< gun_y + 6 : p_hp = p_mhp : weapon(level_stats(1),1) = weapon(level_stats(1),1) + level_stats(2) : delete object gun_obj : endif : endif : endif : endif : endif : endif : paste image 8, mousex()-16, mousey()-16, 1 : if alert_left > 100 : box screen width() - 72, 8, screen width() - 70 + (alert_left/15), 28, rgb((2.5*(alert_left/10)),0,0), rgb((2*(alert_left/10)),0,0), rgb((2.5*(alert_left/10)),0,0), rgb((2*(alert_left/10)),0,0) : endif : text screen width() - 70, 10, "Alert: " + str$(alert_left/10) + "%" : text 10, screen height() - 40, current_weapon_name$+chr$(13)+chr$(10)+str$(weapon(current_weapon,1)) : if p_hp > 0 : box 9, 9, 11+p_mhp, 29, rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0) : box 10, 10, 10+p_hp, 28, rgb(25,204,201), rgb(25,204,201), rgb(163,226,179), rgb(163,226,179) : else : dead = 1 : ending = 1 : endif : sync
until ending = 1 : for a = 201 to b_obj : if SC_collisionStatus(a) = 1 : SC_removeObject a : endif : next a : delete objects 201, b_obj : loop : delete memblock 1
function wraptext(ttw as string, xs as integer) : f_r as string : for a = 1 to len(ttw) : if mid$(ttw,a) = " " : sep = a : endif : if text width(left$(ttw, a)) > xs : if sep = 0 : f_r = f_r + left$(ttw, a)+chr$(13)+chr$(10) : ttw = right$(ttw, len(ttw)-a) : else : f_r = f_r + left$(ttw, sep)+chr$(13)+chr$(10) : ttw = right$(ttw, len(ttw)-sep) : endif : a = 0 : sep = 0 : endif : next a : if f_r = "" : f_r = ttw : else : f_r = f_r + ttw : endif
endfunction f_r
Edit: It's compressed using Ric's 20 line compressor btw.
Edit2: It requires Sparky's collision dll to compile as well.
Edit3: Posting whilst drinking vodka is a no-no.
Edit4: Oh and I've included the exe's for the game and the editor, so if you don't have Sparky's dll then just run them instead of compiling the code.
Edit5: A full devlog can be found on the devaug website:
http://devaug.com/?q=node/52