void runGame(){
readimagefile("PIX\\Landscape.jpg", 0, 0, 800, 800);
while(1 == 1){
moveCharacter();
//moveMonster();
}
}
void moveCharacter(){
int move = 0;
int size = imagesize(0, 0, 800, 800);
void *background = malloc(size);
getimage(0, 0, 800, 800, background);
readimagefile("PIX\\Character\\down_still.gif",x9,y9,x9+50,y9+50);
thunderClaw();
//specialAttack();
//thunderball();
if(kbhit()){
if(getch()== 'd'){
move = 1;
}
if(getch()== 'a'){
move = 3;
}
if(getch()== 'w'){
move = 2;
}
if(getch()== 's'){
move = 4;
}
}
switch (move){
case 1://left
readimagefile("PIX\\Character\\left_r.gif",x9,y9,x9+50,y9+50);Sleep(15);
x9 = x9 + 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\left_still.gif",x9,y9,x9+50,y9+50);Sleep(15);
x9 = x9 + 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\left_l.gif",x9,y9,x9+50,y9+50);Sleep(15);
x9 = x9 + 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\left_still.gif",x9,y9,x9+50,y9+50);Sleep(15);
x9 = x9 + 5;
putimage(0, 0, background, COPY_PUT);
break;
case 2://up
readimagefile("PIX\\Character\\up_r.gif",x9,y9,x9+50,y9+50);Sleep(15);
y9 = y9 - 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\up_still.gif",x9,y9,x9+50,y9+50);Sleep(15);
y9 = y9 - 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\up_l.gif",x9,y9,x9+50,y9+50);Sleep(15);
y9 = y9 - 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\up_still.gif",x9,y9,x9+50,y9+50);Sleep(15);
y9 = y9 - 5;
putimage(0, 0, background, COPY_PUT);
break;
case 3://right
readimagefile("PIX\\Character\\right_r.gif",x9,y9,x9+50,y9+50);Sleep(15);
x9 = x9 - 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\right_still.gif",x9,y9,x9+50,y9+50);Sleep(15);
x9 = x9 - 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\right_l.gif",x9,y9,x9+50,y9+50);Sleep(15);
x9 = x9 - 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\right_still.gif",x9,y9,x9+50,y9+50);Sleep(15);
x9 = x9 - 5;
putimage(0, 0, background, COPY_PUT);
break;
case 4://down
readimagefile("PIX\\Character\\down_l.gif",x9,y9,x9+50,y9+50);Sleep(15);
y9 = y9 + 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\down_still.gif",x9,y9,x9+50,y9+50);Sleep(15);
y9 = y9 + 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\down_r.gif",x9,y9,x9+50,y9+50);Sleep(15);
y9 = y9 + 5;
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Character\\down_still.gif",x9,y9,x9+50,y9+50);Sleep(15);
y9 = y9 + 5;
putimage(0, 0, background, COPY_PUT);
break;
default:
readimagefile("PIX\\Character\\down_still.gif", x9, y9, x9+50, y9+50);
putimage(0, 0, background, COPY_PUT);
}
}//end function
void thunderClaw(){
int mx = mousex();
int my = mousey();
int size = imagesize(0, 0, 800, 800);
void *background = malloc(size);
getimage(0, 0, 800, 800, background);
getmouseclick(WM_LBUTTONDOWN, mx, my);
if(WM_LBUTTONDOWN){
printf("Left mouse button was clicked!\n");
#ifdef SOUNDfx
PlaySound("SOUNDS\\Electricity_Shock_Sound_Effect.wav", NULL, SND_ASYNC);
#endif
readimagefile("PIX\\Thunderclaw\\thunderclaw00.gif", mx-25, my-25, mx+25, my+25);Sleep(80);
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Thunderclaw\\thunderclaw01.gif", mx-25, my-25, mx+25, my+25);Sleep(80);
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Thunderclaw\\thunderclaw0.gif", mx-25, my-25, mx+25, my+25);Sleep(80);
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Thunderclaw\\thunderclaw.gif", mx-25, my-25, mx+25, my+25);Sleep(80);
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Thunderclaw\\thunderclaw2.gif", mx-25, my-25, mx+25, my+25);Sleep(80);
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Thunderclaw\\thunderclaw3.gif", mx-25, my-25, mx+25, my+25);Sleep(80);
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Thunderclaw\\thunderclaw4.gif", mx-25, my-25, mx+25, my+25);Sleep(80);
putimage(0, 0, background, COPY_PUT);
readimagefile("PIX\\Thunderclaw\\thunderclaw5.gif", mx-25, my-25, mx+25, my+25);Sleep(80);
putimage(0, 0, background, COPY_PUT);
}
}
So this is the code I have at the moment. My issue is that it keeps thinking the left mouse button is being clicked constantly. Therefore it is constantly putting the animation in the top left corner and slowing down character movement. I have tried an enourmouse slew of things to stop this but have not been able to figure it out. Google has not helped either. I just don't get how it thinks I am constantly clicking left mouse button. I believe it is because of the if(WM_LBUTTONDOWN) statement. But even that, I have tried changing it, adding different specifications, moving it, getting rid of it, and nothing works out how I need it to. It just constantly thinks left button is being clicked (even when I got rid of if() statement it did this!).
Could anyone help me out on this?
THANKS!