//========================== class Enemy extends Entity{ String name; int health, attack, cycleValue, memoryValue; int gridx, gridy; float vx, vy, speed; boolean isWallBreaker; //--------------- Enemy(String type){ isEnemy = true; isDamageable = true; fillColor = color(255,0,0,128); polyStrokeColor = color(255,64,64,192); lineStrokeColor = color(255,0,0,192); loadEnemy(type); } //--------------- Enemy(int enemyIndex, int gridx, int gridy){ this.x = game.terrain.xPos(gridx); this.y = game.terrain.yPos(gridy); this.fxZ = 5; this.gridx = gridx; this.gridy = gridy; isEnemy = true; isDamageable = true; fillColor = color(255,0,0,128); polyStrokeColor = color(255,64,64,192); lineStrokeColor = color(255,0,0,192); loadEnemy( enemyIndex ); } //--------------- void inflictDamage( int d ){ health -= d; if(health<=0){ kill(); game.rewardResources(cycleValue, memoryValue); } } //--------------- void inflictDeath(){ inflictDamage( 2*health ); } //--------------- void kill(){ super.kill(); game.objs.add( new Death(this) ); } //--------------- void breakWall(int tx, int ty ){ kill(); game.objs.add( new Deletion(tx,ty) ); if( game.terrain.groundEntity[tx][ty] != null) game.terrain.groundEntity[tx][ty].kill(); game.terrain.groundEntity[tx][ty] = null; game.terrain.isPath[tx][ty] = true; game.terrain.calculateAIPath(); } //--------------- void loadEnemy(String filename){ String[] file = loadStrings("enemies/"+filename+".txt"); for(int i=0 ; i