Skip to content

Commit ada09de

Browse files
authored
Merge pull request #54 from marcins1/master
Optymalizacja kodu gry, poprawienie błędu, aktualizacja pliku humans.txt
2 parents 364c857 + 946739b commit ada09de

File tree

6 files changed

+11
-25
lines changed

6 files changed

+11
-25
lines changed

assets/bar1.png

-159 Bytes
Binary file not shown.

assets/bar2.png

-157 Bytes
Binary file not shown.

assets/bar3.png

-163 Bytes
Binary file not shown.

humans.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
Contact: marcin.zasuwa [at] lo1.sandomierz.pl
88
From: Sandomierz, Poland
99

10-
Programmer: Marcin Saja
10+
Web Designer and Programmer: Marcin Saja
1111
Contact: marcin.saja [at] lo1.sandomierz.pl
1212
From: Sandomierz, Poland
1313

14-
Level designer and programmer: Jakub Mazur
14+
Level Designer and Programmer: Jakub Mazur
1515
Contact: jakub.mazur [at] lo1.sandomierz.pl
1616

1717

js/app_p5.js

+8-22
Original file line numberDiff line numberDiff line change
@@ -997,38 +997,30 @@ function Enemy(x, y, eminx, emaxx, direction, type, time, life, drawing, miny, m
997997

998998

999999
this.draw = function () {
1000-
var k = 0;
1001-
1002-
1003-
//Draw Life Bars
1000+
//Draw Life Bars
10041001
switch (this.type) {
10051002
case 0:
10061003
image(lifebar, this.x - game.spos + 3, this.y - 19);
10071004
image(enemyimg, this.x - game.spos, this.y);
1008-
for (j = 0; j < this.life; j++) {
1009-
image(bar2, this.x - game.spos + 6 + k, this.y - 16);
1010-
k += 16;
1011-
}
1005+
fill("#FD8600");
1006+
rect(this.x - game.spos + 5, this.y - 17, 16 * this.life + 1, 6);
10121007
break;
10131008

10141009
case 1:
10151010
image(lifebar, this.x - game.spos + 3, this.y - 19);
10161011
image(enemyimg2, this.x - game.spos, this.y);
1017-
for (j = 0; j < this.life; j++) {
1018-
image(bar1, this.x - game.spos + 6 + k, this.y - 16);
1019-
k += 24;
1020-
}
1012+
fill("#FD8600");
1013+
rect(this.x - game.spos + 5, this.y - 17, 24 * this.life + 1, 6);
10211014
break;
10221015

10231016
case 2:
10241017
image(boss, this.x - game.spos, this.y);
10251018
image(lifebar2, 383, 80);
1026-
for (j = 0; j < this.life; j++) {
1027-
image(bar3, 386 + k, 83);
1028-
k += 8;
1029-
}
1019+
fill("#A50000");
1020+
rect(385, 82, 8 * this.life + 1, 26);
10301021
break;
10311022
}
1023+
fill("#FFFFFF");
10321024
};
10331025

10341026

@@ -1365,9 +1357,6 @@ var enemyimg;
13651357
var enemyimg2;
13661358
var lifebar;
13671359
var lifebar2;
1368-
var bar1;
1369-
var bar2;
1370-
var bar3;
13711360
var heart;
13721361
var boss;
13731362
var pistol = [];
@@ -1378,9 +1367,6 @@ function preload() {
13781367
enemyimg2 = loadImage('./assets/enemy2.png');
13791368
lifebar = loadImage('./assets/lifebar.png');
13801369
lifebar2 = loadImage('./assets/lifebar2.png');
1381-
bar1 = loadImage('./assets/bar1.png');
1382-
bar2 = loadImage('./assets/bar2.png');
1383-
bar3 = loadImage('./assets/bar3.png');
13841370
heart = loadImage('./assets/heart.png');
13851371
boss = loadImage('./assets/boss.png');
13861372
for (i = 0; i < 6; i++) {

js/enemies.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ enemies[2][9][2] = 8600;
172172
enemies[2][9][3] = 8790;
173173
enemies[2][9][4] = true;
174174
enemies[2][9][5] = 1;
175-
enemies[2][9][6] = -1;
175+
enemies[2][9][6] = 0;
176176
enemies[2][9][7] = 2;
177177
enemies[2][9][8] = false;
178178

0 commit comments

Comments
 (0)