Zombie.java
上传用户:qinghua
上传日期:2022-06-06
资源大小:523k
文件大小:4k
- import javax.microedition.midlet.*;
- import javax.microedition.lcdui.*;
- public class Zombie
- {
- public byte zw,zd;
- public int moveghost,movez,zombiex,zombiey,walky,zombilevel;
- boolean zombiedeadflag;
- public Zombie(int zombiex,int zombiey){
- this.zombiex = zombiex;
- this.zombiey =zombiey;
-
- }
-
- public void ZombieWalk(Graphics g)
- {
-
- /* if(ghostx==2)
- walky=54;
- else
- walky=158; */
-
-
- if(zw==0)
- {
- g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zombiex-=5;
- zw++;
- }
- else if(zw==1)
- {
- g.drawImage(HauntedCastle.ghost2,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zw++;
- zombiex-=5;
- }
- else if(zw==2)
- {
- g.drawImage(HauntedCastle.ghost3,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zw++;
- zombiex-=5;
- }
- else if(zw==3)
- {
- g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zombiex-=5;
- zw++;
- }
- else if(zw==4)
- {
- g.drawImage(HauntedCastle.ghost2,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zw++;
- zombiex-=5;
- }
- else if(zw==5)
- {
- g.drawImage(HauntedCastle.ghost3,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zw++;
- zombiex-=5;
- }
-
-
- else if(zw==6)
- {
- g.drawImage(HauntedCastle.ghost1f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zw++;
- zombiex+=5;
- }
- else if(zw==7)
- {
- g.drawImage(HauntedCastle.ghost2f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zw++;
- zombiex+=5;
- }
- else if(zw==8)
- {
- g.drawImage(HauntedCastle.ghost3f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zw++;
- zombiex+=5;
- }
- else if(zw==9)
- {
- g.drawImage(HauntedCastle.ghost1f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zw++;
- zombiex+=5;
- }
- else if(zw==10)
- {
- g.drawImage(HauntedCastle.ghost2f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zw++;
- zombiex+=5;
- }
- else if(zw==11)
- {
- g.drawImage(HauntedCastle.ghost3f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- zw=0;
- zombiex+=5;
- }
-
- }
-
-
- public void ZombieDies(Graphics g)
- {
- /* if(zombiy==2)
- zombilevel=54;
- else
- zombilevel=158;*/
-
- if(zd==0)
- {
- g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast1,zombiex+HauntedCastle.panx+15,zombiey+10,Graphics.TOP|Graphics.LEFT );
-
- zd++;
- }
- else if(zd==1)
- {
- g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast2,zombiex+HauntedCastle.panx+15,zombiey+5,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast2,zombiex+HauntedCastle.panx+15,zombiey+15,Graphics.TOP|Graphics.LEFT );
- zd++;
- //zombiex-=2;
- }
- else if(zd==2)
- {
- g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,zombiex+HauntedCastle.panx+15,zombiey,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,zombiex+HauntedCastle.panx+15,zombiey+25,Graphics.TOP|Graphics.LEFT );
- zd++;
-
- }
- else if(zd==3)
- {
- // g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,zombiex+HauntedCastle.panx+15,zombiey,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,zombiex+HauntedCastle.panx+15,zombiey+35,Graphics.TOP|Graphics.LEFT );
- zd++;
-
- }
-
- }
-
- }
-