@@ -997,38 +997,30 @@ function Enemy(x, y, eminx, emaxx, direction, type, time, life, drawing, miny, m
997
997
998
998
999
999
this . draw = function ( ) {
1000
- var k = 0 ;
1001
-
1002
-
1003
- //Draw Life Bars
1000
+ //Draw Life Bars
1004
1001
switch ( this . type ) {
1005
1002
case 0 :
1006
1003
image ( lifebar , this . x - game . spos + 3 , this . y - 19 ) ;
1007
1004
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 ) ;
1012
1007
break ;
1013
1008
1014
1009
case 1 :
1015
1010
image ( lifebar , this . x - game . spos + 3 , this . y - 19 ) ;
1016
1011
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 ) ;
1021
1014
break ;
1022
1015
1023
1016
case 2 :
1024
1017
image ( boss , this . x - game . spos , this . y ) ;
1025
1018
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 ) ;
1030
1021
break ;
1031
1022
}
1023
+ fill ( "#FFFFFF" ) ;
1032
1024
} ;
1033
1025
1034
1026
@@ -1365,9 +1357,6 @@ var enemyimg;
1365
1357
var enemyimg2 ;
1366
1358
var lifebar ;
1367
1359
var lifebar2 ;
1368
- var bar1 ;
1369
- var bar2 ;
1370
- var bar3 ;
1371
1360
var heart ;
1372
1361
var boss ;
1373
1362
var pistol = [ ] ;
@@ -1378,9 +1367,6 @@ function preload() {
1378
1367
enemyimg2 = loadImage ( './assets/enemy2.png' ) ;
1379
1368
lifebar = loadImage ( './assets/lifebar.png' ) ;
1380
1369
lifebar2 = loadImage ( './assets/lifebar2.png' ) ;
1381
- bar1 = loadImage ( './assets/bar1.png' ) ;
1382
- bar2 = loadImage ( './assets/bar2.png' ) ;
1383
- bar3 = loadImage ( './assets/bar3.png' ) ;
1384
1370
heart = loadImage ( './assets/heart.png' ) ;
1385
1371
boss = loadImage ( './assets/boss.png' ) ;
1386
1372
for ( i = 0 ; i < 6 ; i ++ ) {
0 commit comments