Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
A jam submission

AlienAttackView game page

Submitted by Menedek — 52 minutes, 34 seconds before the deadline
Add to collection

Play game

AlienAttack's itch.io page

Results

CriteriaRankScore*Raw Score
Graphics#112.1912.400
Winner#151.4611.600
Gameplay#151.6431.800
Sound#151.2781.400

Ranked from 5 ratings. Score is adjusted from raw score by the median number of ratings per game in the jam.

Source Code
(* AlienAttack
* Menedék Programming Club, 2018.
* Concept: Rizsa, Shadow, TBC
* Design: Imi, Szántosz
* Code: TBC
*)

unit Main;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls;

type

koord = record
x: integer;
y: integer;
end;

{ Tfrm_Main }

Tfrm_Main = class(TForm)
img_Jt: TImage;
Timer_Lepes: TTimer;
procedure FormCreate(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: char);
procedure Timer_LepesTimer(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;

var
frm_Main: Tfrm_Main;
x: byte; // Ágyú x koordinátája
alien1: byte; // Alien x koordinátája
alien2: byte;
alien3: byte;
sl: koord; // Saját lövedék koordinátája
slx: boolean; // Van saját lövedék a játéktéren?
al1, al2, al3: koord; // Alien lövedékek koordinátái
al1x, al2x, al3x: boolean; // Alien lövedékek jelenléte
pont, elet: integer;

const
x_m = 24;
y_m = 22;
szin_vilagos = 14540253; // #DDDDDD
szin_sotet = 13421772; // #CCCCCC

implementation

{$R *.lfm}

{ Adott sprite kigyújtása vagy kioltása }
Procedure valt(var kep: TImage; celallapot: Boolean; n, m: byte);
var i, j: integer;
szin1, szin2: longint;
Begin
if celallapot=True then Begin
szin1 := szin_sotet;
szin2 := 0;
end;
if celallapot=False then Begin
szin1 := 0;
szin2 := szin_sotet;
end;

for j:=(m-1)*24 to m*24-1 do Begin
for i:=(n-1)*24 to n*24-1 do Begin
if kep.Canvas.Pixels[i,j]=szin1 then Begin
kep.Canvas.Pixels[i,j] := szin2;
end;
end;
end;
End;

{ Tfrm_Main }

procedure Tfrm_Main.FormCreate(Sender: TObject);
var i, j: integer;
begin
{ A játéktér beállítása }
for j:=0 to 239 do Begin
for i:=0 to 319 do Begin
if img_Jt.Canvas.Pixels[i,j]=16777215 then Begin
img_Jt.Canvas.Pixels[i,j] := szin_vilagos;
end;
if img_Jt.Canvas.Pixels[i,j]=0 then Begin
img_Jt.Canvas.Pixels[i,j] := szin_sotet;
end;
end;
end;
img_Jt.Canvas.Brush.Color := szin_sotet;
for j:=2 to 9 do Begin
for i:=1 to 13 do Begin
img_Jt.Canvas.FillRect((i-1)*24+5, (j-1)*24+5, i*24-4, j*24-4);
end;
end;

Randomize;
end;

procedure Tfrm_Main.FormKeyPress(Sender: TObject; var Key: char);
var i, j: integer;
begin
if Key=' ' then Begin
if slx=False then Begin
slx := True;
sl.y := 9;
sl.x := x;
valt(img_Jt, True, sl.x, sl.y);
end;
end;
if Key='a' then Begin
if x>1 then Begin
valt(img_Jt, False, x, 10);
dec(x);
valt(img_Jt, True, x, 10);
end;
end;
if Key='d' then Begin
if x<13 then Begin
valt(img_Jt, False, x, 10);
inc(x);
valt(img_Jt, True, x, 10);
end;
end;
if Key='s' then Begin
if Timer_Lepes.Enabled = False then Begin
Timer_Lepes.Interval := 500;
Timer_Lepes.Enabled := True;;

{ Inicializálás }
for i:=1 to 13 do Begin
for j:=1 to 10 do Begin
valt(img_Jt, False, i, j);
end;
end;
x := 7;
alien1 := 7;
alien2 := 3;
alien3 := 10;
slx := False;
al1x := False;
al2x := False;
al3x := False;
pont := 0;
elet := 3;
end;
end;
end;

procedure Tfrm_Main.Timer_LepesTimer(Sender: TObject);
var vel: integer;
i, j: integer;
sor, marad: integer;
begin
{ Alakzatok eltüntetése }
valt(img_Jt, False, alien1, 1);
valt(img_Jt, False, alien2, 1);
valt(img_Jt, False, alien3, 1);
if slx then Begin
valt(img_Jt, False, sl.x, sl.y);
end;
if al1x then Begin
valt(img_Jt, False, al1.x, al1.y);
end;
if al2x then Begin
valt(img_Jt, False, al2.x, al2.y);
end;
if al3x then Begin
valt(img_Jt, False, al3.x, al3.y);
end;
valt(img_Jt, False, x, 10);

{ Alienek léptetése }
vel := random(10)+1;
if (vel<=4) and (alien1>1) then Begin
dec(alien1);
end;
if (vel>=6) and (alien1<13) then Begin
inc(alien1);
end;
vel := random(10)+1;
if (vel<=2) and (alien2>1) then Begin
dec(alien2);
end;
if (vel>=8) and (alien2<13) then Begin
inc(alien2);
end;
vel := random(10)+1;
if (vel<=3) and (alien3>1) then Begin
dec(alien3);
end;
if (vel>=7) and (alien3<13) then Begin
inc(alien3);
end;

{ Lövedékek léptetése }
if slx then Begin // Saját lövedék léptetése
if sl.y>1 then Begin // Ha nem érte el a felső sort
dec(sl.y);
end;
if sl.y=1 then Begin // Ha elérte a felső sort
if sl.x = alien1 then Begin
alien1 := 7;
if Timer_Lepes.Interval>100 then Begin
Timer_Lepes.Interval := Timer_Lepes.Interval - 10;
end;
inc(pont);
end;
if sl.x = alien2 then Begin
alien2 := 3;
if Timer_Lepes.Interval>100 then Begin
Timer_Lepes.Interval := Timer_Lepes.Interval - 10;
end;
inc(pont);
end;
if sl.x = alien3 then Begin
alien3 := 10;
if Timer_Lepes.Interval>100 then Begin
Timer_Lepes.Interval := Timer_Lepes.Interval - 10;
end;
inc(pont);
end;
slx := False;
end;
end;
if al1x then Begin // Alien lövedék 1 léptetése
if al1.y<10 then Begin // Ha nem érte el az alsó sort
inc(al1.y);
end;
if al1.y=10 then Begin // Ha elérte az alsó sort
if al1.x = x then Begin
dec(elet);
sysutils.Beep;
x := 7;
end;
al1x := False;
end;
end;
if al2x then Begin // Alien lövedék 2 léptetése
if al2.y<10 then Begin // Ha nem érte el az alsó sort
inc(al2.y);
end;
if al2.y=10 then Begin // Ha elérte az alsó sort
if al2.x = x then Begin
dec(elet);
sysutils.Beep;
x := 7;
end;
al2x := False;
end;
end;
if al3x then Begin // Alien lövedék 3 léptetése
if al3.y<10 then Begin // Ha nem érte el az alsó sort
inc(al3.y);
end;
if al3.y=10 then Begin // Ha elérte az alsó sort
if al3.x = x then Begin
dec(elet);
sysutils.Beep;
x := 7;
end;
al3x := False;
end;
end;

{ Alienek lövése }
if al1x=False then Begin
vel := random(10)+1;
if vel<=2 then Begin
al1x := True;
al1.y := 2;
al1.x := alien1;
end;
End;
if al2x=False then Begin
vel := random(10)+1;
if vel<=2 then Begin
al2x := True;
al2.y := 2;
al2.x := alien2;
end;
End;
if al3x=False then Begin
vel := random(10)+1;
if vel<=2 then Begin
al3x := True;
al3.y := 2;
al3.x := alien3;
end;
End;

{ Alakzatok megjelenítése }
valt(img_Jt, True, alien1, 1);
valt(img_Jt, True, alien2, 1);
valt(img_Jt, True, alien3, 1);
if slx then Begin
valt(img_Jt, True, sl.x, sl.y);
end;
if al1x then Begin
valt(img_Jt, True, al1.x, al1.y);
end;
if al2x then Begin
valt(img_Jt, True, al2.x, al2.y);
end;
if al3x then Begin
valt(img_Jt, True, al3.x, al3.y);
end;
valt(img_Jt, True, x, 10);

if elet<1 then Begin // Ha elfogytak az életek
Timer_Lepes.Enabled := False;
for i:=1 to 13 do Begin
for j:=1 to 10 do Begin
valt(img_Jt, False, i, j);
end;
end;
sor := pont div 13;
marad := pont mod 13;
if sor>0 then Begin
for j:=2 to sor+1 do Begin
for i:=1 to 13 do valt(img_Jt, True, i, j);
end;
end;
for i:=1 to marad do valt(img_Jt, True, i, sor+2);
end;

end;

end.

Leave a comment

Log in with itch.io to leave a comment.

Comments

HostSubmitted

Far from finished entry, but as PixelPaladin puts it: cool style! :D

Submitted

The bullets should be a lot faster in my opinion. This would make hitting enemies much less random.

The minimalist graphics style is super cool ^^