Ghost.java
上传用户:qinghua
上传日期:2022-06-06
资源大小:523k
文件大小:4k
- import javax.microedition.midlet.*;
- import javax.microedition.lcdui.*;
- public class Ghost
- {
- public byte zw,zd;
- public int moveghost,movez,ghostx,ghosty,walky,zombilevel;
- boolean ghostdeadflag;
- public Ghost(int ghostx,int ghosty){
- this.ghostx = ghostx;
- this.ghosty =ghosty;
-
- }
-
- public void GhostWalk(Graphics g)
- {
-
- /* if(ghostx==2)
- walky=54;
- else
- walky=158; */
-
-
- if(zw==0)
- {
- g.drawImage(HauntedCastle.casper1,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- ghostx-=5;
- zw++;
- }
- else if(zw==1)
- {
- g.drawImage(HauntedCastle.casper2,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- zw++;
- ghostx-=5;
- }
- else if(zw==2)
- {
- g.drawImage(HauntedCastle.casper1,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- zw++;
- ghostx-=5;
- }
- else
- if(zw==3)
- {
- g.drawImage(HauntedCastle.casper2,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- ghostx-=5;
- zw++;
- }
- else if(zw==4)
- {
- g.drawImage(HauntedCastle.casper1,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- zw++;
- ghostx-=5;
- }
- else if(zw==5)
- {
- g.drawImage(HauntedCastle.casper2,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- zw++;
- ghostx-=5;
- }
-
-
- else if(zw==6)
- {
- g.drawImage(HauntedCastle.casper1f,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- zw++;
- ghostx+=5;
- }
- else if(zw==7)
- {
- g.drawImage(HauntedCastle.casper2f,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- zw++;
- ghostx+=5;
- }
- else if(zw==8)
- {
- g.drawImage(HauntedCastle.casper1f,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- zw++;
- ghostx+=5;
- }
- else if(zw==9)
- {
- g.drawImage(HauntedCastle.casper2f,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- zw++;
- ghostx+=5;
- }
- else if(zw==10)
- {
- g.drawImage(HauntedCastle.casper1f,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- zw++;
- ghostx+=5;
- }
- else if(zw==11)
- {
- g.drawImage(HauntedCastle.casper2f,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- zw=0;
- ghostx+=5;
- }
-
- }
-
-
- public void GhostDies(Graphics g)
- {
- /* if(zombiy==2)
- zombilevel=54;
- else
- zombilevel=158;*/
-
- if(zd==0)
- {
- g.drawImage(HauntedCastle.casper1,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast1,ghostx+HauntedCastle.panx+5,ghosty+10,Graphics.TOP|Graphics.LEFT );
-
- zd++;
- }
- else if(zd==1)
- {
- g.drawImage(HauntedCastle.casper1,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast2,ghostx+HauntedCastle.panx+5,ghosty+5,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast2,ghostx+HauntedCastle.panx+5,ghosty+15,Graphics.TOP|Graphics.LEFT );
- zd++;
- //ghostx-=2;
- }
- else if(zd==2)
- {
- g.drawImage(HauntedCastle.casper1,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,ghostx+HauntedCastle.panx+5,ghosty,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,ghostx+HauntedCastle.panx+5,ghosty+25,Graphics.TOP|Graphics.LEFT );
- zd++;
-
- }
- else if(zd==3)
- {
- // g.drawImage(HauntedCastle.ghost1,ghostx+HauntedCastle.panx,ghosty,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,ghostx+HauntedCastle.panx+5,ghosty-5,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,ghostx+HauntedCastle.panx+5,ghosty+30,Graphics.TOP|Graphics.LEFT );
- zd++;
-
- }
-
- }
-
- }
-