damagex Posted September 8, 2011 Share Posted September 8, 2011 [align=center] Top down shooter Created by: damagex Current V1.2a This topic will be updated whenever I release a next version. Please report any bugs to me. [spoiler=[b]Controls[/b]] What controls do I use? Movement = Left/Right arrows Shoot = Left CTRL [spoiler=[b]Features[/b]] Current features: Kill counter Lifes system Adjustable Field Height and Width Adjustable background (stars) Adjustable Refresh Rate Future features: - Powerups (Extra life, stronger bullets) - Ship movement (up and down) - Extra weapons - More enemies [scar] (* Easy Top Down Shooter *) { Created by: damagex @ scar-divi.com } { Version 1.2a } const //Difficulty settings\\ refreshRate = 100; // Low = hard - High = easy fieldWidth = 30; // Low = easy - High = hard fieldHeight = 10; // Low = hard - High = easy //Other Settings\\ useBackground = 0; // 0 = off - 1 = on var fieldArr : Array[1..fieldWidth] of Array[0..fieldHeight] of String; field : Array [0..fieldHeight] of AnsiString; enemy, bullet : Array [0..fieldHeight] of Integer; i, e, f, bg, current, Lifes, score : Integer; isShooting, isEnemy, spawnEnemy : Integer; information, layout : String; repeater : Integer; begin repeater := 0; lifes := 3; spawnEnemy := 0; isEnemy := 0; current := fieldWidth div 2; isShooting := 0; score := 0; information := ''; for i := low(enemy) to high(enemy) do begin enemy := 0; end; for i := low(bullet) to high(bullet) do begin bullet := 0; end; repeat // Input Handler if (IsArrowDown(1)) then begin if(current < fieldWidth) then begin current := current + 1; end; end; if (IsArrowDown(3)) then begin if(current > Low(fieldArr)) then begin current := current - 1; end; end; if (IsFunctionKeyDown(4)) AND not (isShooting <> 0) then begin bullet[1] := current; isShooting := 1; end; // Enemy handler spawnEnemy := 1; if (spawnEnemy = 1) AND not (isEnemy <> 0) then begin isEnemy := 1; enemy[high(enemy)] := RandomRange(Low(fieldArr)+1,fieldWidth); spawnEnemy := 0; end; layout := ''; for f := low(fieldArr) to fieldWidth do begin layout := layout + '_'; end; for f := low(field) to fieldHeight do begin field[f] := '|'; end; for i := low(fieldArr) to fieldWidth do begin for e:= low(field) to fieldHeight do begin if (e = 0) then begin if (i <> current) then begin fieldArr[0] := ' '; end else begin fieldArr[0] := 'A'; end; end else begin if (i <> bullet[e]) then begin if (i <> enemy[e]) then begin if (useBackground = 1) then begin bg := RandomRange(0,50); end; if not (bg = 1) then begin fieldArr[e] := ' '; bg := 0; end else begin fieldArr[e] := '+'; end; end else begin fieldArr[e] := 'V'; end; end else begin fieldArr[e] := '.'; end; end; end; for f := low(field) to high(field) do begin field[f] := field[f] + fieldArr[f]; end; end; for f := low(field) to high(field) do begin field[f] := field[f] + '|'; end; clearDebug; WriteLn(' '+layout+' '); i := high(field); while (i > -1) do begin WriteLn(field); i := i - 1; end; WriteLn('|'+layout+'|'); WriteLn(information); WriteLn('Press "CTRL + ALT + S" to stop playing'); WriteLn('Created by: Damagex @ scar-divi.com'); WriteLn(bg); wait(refreshRate); i := 1; for i := 1 to fieldHeight do begin if (enemy = bullet) AND (enemy <> 0) OR (enemy[i-1] = bullet) AND (enemy[i-1] <> 0) then begin enemy := 0; enemy[i-1] := 0; bullet := 0; isShooting := 0; isEnemy := 0; Score := Score + 1; end; end; i := 1; e := 0; if (isShooting = 1) then begin while (e = 0) do begin if (i = high(bullet)) then begin isShooting := 0; e := 1; end else if (bullet > 0) then begin e := 1; bullet[i+1] := bullet; end; bullet := 0; i := i + 1; end; end; if (repeater > 5) then begin i := fieldHeight; e := 0; if (isEnemy = 1) then begin while (e = 0) do begin if (i = 1) then begin e := 1; isEnemy := 0; lifes := lifes-1; end else if (enemy > 0) then begin e := 1; enemy[i-1] := enemy; end; enemy := 0; i := i - 1; end; end; repeater := 0; end else begin repeater := repeater + 1; end; information := 'Kills: ' + IntToStr(score) + ' - Lifes left: ' + IntToStr(lifes); until(lifes = -1); ClearDebug; WriteLn(' _____________________________________________________________________ '); WriteLn('| ______ _______ _______ _______ _____ _ _ _______ ______ |'); WriteLn('| | ____ |_____| | | | |______ | | \ / |______ |_____/ |'); WriteLn('| |_____| | | | | | |______ |_____| \/ |______ | \_ |'); WriteLn('| Game Report scar-divi.com |'); WriteLn('| Final Kill Count: ' + IntToStr(score) + ' Damagex |'); WriteLn('|_____________________________________________________________________|'); end. [/scar] [spoiler=[b]Changelog[/b]] version 1.2a Script tweaks New adjustable settings for difficulty [spoiler=[b]Older Versions[/b]] [scar](*Top Down Shooter *) { Created by: damagex @ scar-divi.com } { Version 0.8a } const refreshRate = 500; //Lower = Faster = More difficult fieldWidth = 20; //Higher = Bigger = More difficult var Field0Arr, Field1Arr, Field2Arr, Field3Arr, Field4Arr, Field5Arr, Field6Arr, Field7Arr : Array[1..fieldWidth] of String; i, current, bullet, bullet1, bullet2, bullet3, bullet4, bullet5, bullet6, bullet7 : Integer; enemy, enemy1, enemy2, enemy3, enemy4, enemy5, enemy6, enemy7 : Integer; isShooting, isEnemy, spawnEnemy, Lifes, score: Integer; Field0, Field1, Field2, Field3, Field4, Field5, Field6, Field7, information : String; begin lifes := 3; spawnEnemy := 0; isEnemy := 0; enemy := 0; enemy1 := 0; enemy2 := 0; enemy3 := 0; enemy4 := 0; enemy5 := 0; enemy6 := 0; enemy7 := 0; current := fieldWidth div 2; bullet := 0; bullet2 := 0; bullet3 := 0; bullet4 := 0; bullet5 := 0; bullet6 := 0; bullet7 := 0; isShooting := 0; score := 0; information := ''; repeat // Input Handler if (IsArrowDown(1)) then begin if(current < High(Field0Arr)) then begin current := current + 1; end; end; if (IsArrowDown(3)) then begin if(current > Low(Field0Arr)) then begin current := current - 1; end; end; if (IsFunctionKeyDown(4)) AND not (isShooting <> 0) then begin bullet := current + 1; isShooting := 1; end; // Enemy handler spawnEnemy := RandomRange(0,10); if (spawnEnemy = 1) AND not (isEnemy <> 0) then begin isEnemy := 1; enemy7 := RandomRange(Low(Field0Arr)+1,High(Field0Arr)); spawnEnemy := 0; end; // Field Updater Field0 := '|'; Field1 := '|'; Field2 := '|'; Field3 := '|'; Field4 := '|'; Field5 := '|'; Field6 := '|'; Field7 := '|'; for i := Low(Field0Arr) to High(Field0Arr) do begin if (i <> current) then begin Field0Arr := ' '; End else begin Field0Arr := '/|\'; end; if (i <> bullet) then begin if (i <> enemy) then begin Field1Arr := ' '; end else begin Field1Arr := 'V'; end; end else begin Field1Arr := '.'; end; if (i <> bullet2) then begin if (i <> enemy2) then begin Field2Arr := ' '; end else begin Field2Arr := 'V'; end; end else begin Field2Arr := '.'; end; if (i <> bullet3) then begin if (i <> enemy3) then begin Field3Arr := ' '; end else begin Field3Arr := 'V'; end; end else begin Field3Arr := '.'; end; if (i <> bullet4) then begin if (i <> enemy4) then begin Field4Arr := ' '; end else begin Field4Arr := 'V'; end; end else begin Field4Arr := '.'; end; if (i <> bullet5) then begin if (i <> enemy5) then begin Field5Arr := ' '; end else begin Field5Arr := 'V'; end; end else begin Field5Arr := '.'; end; if (i <> bullet6) then begin if (i <> enemy6) then begin Field6Arr := ' '; end else begin Field6Arr := 'V'; end; end else begin Field6Arr := '.'; end; if (i <> bullet7) then begin if (i <> enemy7) then begin Field7Arr := ' '; end else begin Field7Arr := 'V'; end; end else begin Field7Arr := '.'; end; Field0 := Field0 + Field0Arr; Field1 := Field1 + Field1Arr; Field2 := Field2 + Field2Arr; Field3 := Field3 + Field3Arr; Field4 := Field4 + Field4Arr; Field5 := Field5 + Field5Arr; Field6 := Field6 + Field6Arr; Field7 := Field7 + Field7Arr; end; Field0 := Field0 + '|' Field1 := Field1 + ' |' Field2 := Field2 + ' |' Field3 := Field3 + ' |' Field4 := Field4 + ' |' Field5 := Field5 + ' |' Field6 := Field6 + ' |' Field7 := Field7 + ' |' ClearDebug; WriteLn(Field7); WriteLn(Field6); WriteLn(Field5); WriteLn(Field4); WriteLn(Field3); WriteLn(Field2); WriteLn(Field1); WriteLn(Field0); WriteLn(information); WriteLn('Press "CTRL + ALT + S" to stop playing'); WriteLn('Created by: Damagex @ scar-divi.com'); wait(refreshRate); if (enemy = bullet) AND (enemy <> 0) OR (enemy2 = bullet) AND (enemy2 <> 0) then begin enemy := 0; enemy2 := 0; bullet := 0; isShooting := 0; isEnemy := 0; Score := Score + 1; end else if (enemy2 = bullet2) AND (enemy2 <> 0) OR (enemy3 = bullet2) AND (enemy3 <> 0) then begin enemy2 := 0; enemy3 := 0; bullet2 := 0; isShooting := 0; isEnemy := 0; Score := Score + 1; end else if (enemy3 = bullet3) AND (enemy3 <> 0) OR (enemy4 = bullet3) AND (enemy4 <> 0) then begin enemy3 := 0; enemy4 := 0; bullet3 := 0; isShooting := 0; isEnemy := 0; Score := Score + 1; end else if (enemy4 = bullet4) AND (enemy4 <> 0) OR (enemy5 = bullet4) AND (enemy5 <> 0) then begin enemy4 := 0; enemy5 := 0; bullet4 := 0; isShooting := 0; isEnemy := 0; Score := Score + 1; end else if (enemy5 = bullet5) AND (enemy5 <> 0) OR (enemy6 = bullet5) AND (enemy6 <> 0) then begin enemy5 := 0; enemy6 := 0; bullet5 := 0; isShooting := 0; isEnemy := 0; Score := Score + 1; end else if (enemy6 = bullet6) AND (enemy6 <> 0) OR (enemy7 = bullet6) AND (enemy7 <> 0) then begin enemy6 := 0; enemy7 := 0; bullet6 := 0; isShooting := 0; isEnemy := 0; Score := Score + 1; end else if (enemy7 = bullet7) AND (enemy7 <> 0) then begin enemy7 := 0; bullet7 := 0; isShooting := 0; isEnemy := 0; Score := Score + 1; end; if (bullet > 0)then begin bullet2 := bullet; bullet := 0; end else if (bullet2 > 0) then begin bullet3 := bullet2; bullet2 := 0; end else if (bullet3 > 0) then begin bullet4 := bullet3; bullet3 := 0; end else if (bullet4 > 0) then begin bullet5 := bullet4; bullet4 := 0; end else if (bullet5 > 0) then begin bullet6 := bullet5; bullet5 := 0; end else if (bullet6 > 0) then begin bullet7 := bullet6; bullet6 := 0; end else if (bullet7 > 0) then begin bullet7 := 0 isShooting := 0; end; if(enemy7 > 0)then begin enemy6 := enemy7; enemy7 := 0; end else if (enemy6 > 0) then begin enemy5 := enemy6; enemy6 := 0; end else if (enemy5 > 0) then begin enemy4 := enemy5; enemy5 := 0; end else if (enemy4 > 0) then begin enemy3 := enemy4; enemy4 := 0; end else if (enemy3 > 0) then begin enemy2 := enemy3; enemy3 := 0; end else if (enemy2 > 0) then begin enemy := enemy2; enemy2 := 0; end else if (enemy > 0) then begin enemy:= 0 isEnemy := 0; lifes := lifes - 1; end; information := 'Kills: ' + IntToStr(score) + ' - Lifes left: ' + IntToStr(lifes); until(lifes = -1); ClearDebug; WriteLn(' _____________________________________________________________________ '); WriteLn('| ______ _______ _______ _______ _____ _ _ _______ ______ |'); WriteLn('| | ____ |_____| | | | |______ | | \ / |______ |_____/ |'); WriteLn('| |_____| | | | | | |______ |_____| \/ |______ | \_ |'); WriteLn('| Game Report scar-divi.com |'); WriteLn('| Final Kill Count: ' + IntToStr(score) + ' Damagex |'); WriteLn('| Playtime: ' + IntToStr(GetTimeRunning) + ' ms |'); WriteLn('|_____________________________________________________________________|'); end.[/scar] [/align] Quote Link to comment Share on other sites More sharing options...
FHannes Posted September 8, 2011 Share Posted September 8, 2011 Heh, nice, I've never seen anything quite like that It might be a good idea to use drawing on the debug image rather than using the debug box though, it will make the game a lot more stable. Quote Link to comment Share on other sites More sharing options...
damagex Posted September 9, 2011 Author Share Posted September 9, 2011 Thanks, it was my intention to use the debugbox and make the game look like this, but now that I think of it, I might be able to create a GUI with a large textbox and make the game playable there. I'm not that much familiar with the drawing functions yet, but I will look into that later. Updated! Redone the script, it's now much more dynamic. Quote Link to comment Share on other sites More sharing options...
Newbie Posted January 5, 2012 Share Posted January 5, 2012 Ok this sounds stupid but how do I use this. i have opened up my Scar Divi CDE and copied the code. What next? Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 5, 2012 Share Posted January 5, 2012 Press run... Quote Link to comment Share on other sites More sharing options...
clickhere Posted August 27, 2012 Share Posted August 27, 2012 Unknown identifier: Is arrow down? I get that when i try to run it Quote Link to comment Share on other sites More sharing options...
LordJashin Posted August 27, 2012 Share Posted August 27, 2012 Grave dig lols. You have to run this with SCAR 3.34 or lower or with SCAR 3.22 Quote Link to comment Share on other sites More sharing options...
clickhere Posted September 25, 2012 Share Posted September 25, 2012 Oh right lols Quote Link to comment Share on other sites More sharing options...
MarkD Posted September 26, 2012 Share Posted September 26, 2012 Or replace the arrowdown functions, as far as I see it's the only thing that doesn't work in 3.35 and later. The rest should still be working. Quote Link to comment Share on other sites More sharing options...