1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
void boss_animation()
{
for (int i = 0; i < 4; i++){
if( ! boss[i].drawable)
continue;
//Puts image of character on screen based on inputs from struct
readimagefile(boss[i].frames[boss[i].currentFrame],
boss[i].xCoord,
boss[i].yCoord,
boss[i].xCoord + boss[i].charWidth,
boss[i].yCoord + boss[i].charHeight );
boss[i].currentFrame++; //increments the "frame" by one, thus only animating one image at a time
if(boss[i].currentFrame == boss[i].animationFrames){
boss[i].currentFrame = 0;} //When frame 4 is reached, it resorts back to first frame and restarts
//character[i].drawable = 0;}
boss[i].xCoord += boss[i].xMove;
boss[i].yCoord += boss[i].yMove;
}
for (int i = 4; i < 8; i++){
if( ! boss[i].drawable)
continue;
if(i == 4){
while(boss[i].xCoord < 733) {
//Puts image of character on screen based on inputs from struct
readimagefile(boss[i].frames[boss[i].currentFrame],
boss[i].xCoord,
boss[i].yCoord,
boss[i].xCoord + boss[i].charWidth,
boss[i].yCoord + boss[i].charHeight );
boss[i].currentFrame++; //increments the "frame" by one, thus only animating one image at a time
if(boss[i].currentFrame == boss[i].animationFrames){
boss[i].currentFrame = 0;}
boss[i].xCoord = boss[i].xCoord + 10;}}
else if(i == 5){
while(boss[i].xCoord > 30){
//Puts image of character on screen based on inputs from struct
readimagefile(boss[i].frames[boss[i].currentFrame],
boss[i].xCoord,
boss[i].yCoord,
boss[i].xCoord + boss[i].charWidth,
boss[i].yCoord + boss[i].charHeight );
boss[i].currentFrame++; //increments the "frame" by one, thus only animating one image at a time
if(boss[i].currentFrame == boss[i].animationFrames){
boss[i].currentFrame = 0;}
boss[i].xCoord = boss[i].xCoord - 10;}}
else if(i == 6){
while(boss[i].yCoord > 60){
//Puts image of character on screen based on inputs from struct
readimagefile(boss[i].frames[boss[i].currentFrame],
boss[i].xCoord,
boss[i].yCoord,
boss[i].xCoord + boss[i].charWidth,
boss[i].yCoord + boss[i].charHeight );
boss[i].currentFrame++; //increments the "frame" by one, thus only animating one image at a time
if(boss[i].currentFrame == boss[i].animationFrames){
boss[i].currentFrame = 0;}
boss[i].yCoord = boss[i].yCoord - 10;}}
else if(i == 7){
while(boss[i].yCoord < 682){
//Puts image of character on screen based on inputs from struct
readimagefile(boss[i].frames[boss[i].currentFrame],
boss[i].xCoord,
boss[i].yCoord,
boss[i].xCoord + boss[i].charWidth,
boss[i].yCoord + boss[i].charHeight );
boss[i].currentFrame++; //increments the "frame" by one, thus only animating one image at a time
if(boss[i].currentFrame == boss[i].animationFrames){
boss[i].currentFrame = 0;}
boss[i].yCoord = boss[i].yCoord + 10;}}
//putimage(0, 0, bkimage, COPY_PUT);
//Sleep(10);
}
}
void playBoss(){
int olddirection = 0, newdirection = 0;
int bossDirection;
int health = 500;
int activate = 0;
initSectors2();
initSectors3();
do {
bossDirection = rand() % 4;
if(bossDirection == 0)
newdirection = 0;
if(bossDirection == 1)
newdirection = 1;
if(bossDirection == 2)
newdirection = 2;
if(bossDirection == 3)
newdirection = 3;
if(boss[newdirection].xCoord == character[newdirection].xCoord || boss[newdirection].yCoord == character[newdirection].yCoord){
if(newdirection == 0){
newdirection = 4;}
else if(newdirection == 1){
newdirection = 5;}
else if(newdirection == 2){
newdirection = 6;}
else if(newdirection == 3){
newdirection = 7;}
}
if(olddirection != newdirection){
boss[newdirection].xCoord = boss[olddirection].xCoord;
boss[newdirection].yCoord = boss[olddirection].yCoord;
boss[olddirection].drawable = 0;
boss[newdirection].drawable = 1;
boss[newdirection].currentFrame = 0;
if(newdirection == 0 || newdirection == 1 || newdirection == 2 || newdirection == 3){
olddirection = newdirection;}
}
checkSectorsBoss();
shadowballSectors();
boss_animation();
Sleep(70);
check_boss();
activate = 1;
}
while(health > 0);
}
|