Zombie.java
上传用户:qinghua
上传日期:2022-06-06
资源大小:523k
文件大小:4k
源码类别:

J2ME

开发平台:

Java

  1. import javax.microedition.midlet.*;
  2. import javax.microedition.lcdui.*;
  3. public class Zombie
  4. {
  5. public byte zw,zd;
  6. public int moveghost,movez,zombiex,zombiey,walky,zombilevel;
  7.     boolean zombiedeadflag;
  8.     public Zombie(int zombiex,int zombiey){
  9.      this.zombiex = zombiex;
  10.      this.zombiey =zombiey;
  11.     
  12.     }
  13.     
  14.     public void  ZombieWalk(Graphics g)
  15. {
  16. /* if(ghostx==2)
  17. walky=54;
  18. else
  19. walky=158; */
  20. if(zw==0)
  21. {
  22. g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  23. zombiex-=5;
  24. zw++;
  25. }
  26. else if(zw==1)
  27. {
  28. g.drawImage(HauntedCastle.ghost2,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  29. zw++;
  30. zombiex-=5;
  31. }
  32. else if(zw==2)
  33. {
  34. g.drawImage(HauntedCastle.ghost3,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  35. zw++;
  36. zombiex-=5;
  37. }
  38. else if(zw==3)
  39. {
  40. g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  41. zombiex-=5;
  42. zw++;
  43. }
  44. else if(zw==4)
  45. {
  46. g.drawImage(HauntedCastle.ghost2,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  47. zw++;
  48. zombiex-=5;
  49. }
  50. else if(zw==5)
  51. {
  52. g.drawImage(HauntedCastle.ghost3,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  53. zw++;
  54. zombiex-=5;
  55. }
  56. else if(zw==6)
  57. {
  58. g.drawImage(HauntedCastle.ghost1f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  59. zw++;
  60. zombiex+=5;
  61. }
  62. else if(zw==7)
  63. {
  64. g.drawImage(HauntedCastle.ghost2f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  65. zw++;
  66. zombiex+=5;
  67. }
  68. else if(zw==8)
  69. {
  70. g.drawImage(HauntedCastle.ghost3f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  71. zw++;
  72. zombiex+=5;
  73. }
  74. else if(zw==9)
  75. {
  76. g.drawImage(HauntedCastle.ghost1f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  77. zw++;
  78. zombiex+=5;
  79. }
  80. else if(zw==10)
  81. {
  82. g.drawImage(HauntedCastle.ghost2f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  83. zw++;
  84. zombiex+=5;
  85. }
  86. else if(zw==11)
  87. {
  88. g.drawImage(HauntedCastle.ghost3f,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  89. zw=0;
  90. zombiex+=5;
  91. }
  92. }
  93. public void  ZombieDies(Graphics g)
  94. {
  95.    /* if(zombiy==2)
  96.     zombilevel=54;
  97.     else
  98.     zombilevel=158;*/
  99.        
  100.     if(zd==0)
  101.     {
  102.         g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  103. g.drawImage(HauntedCastle.fireblast1,zombiex+HauntedCastle.panx+15,zombiey+10,Graphics.TOP|Graphics.LEFT );
  104. zd++;
  105. }
  106. else if(zd==1)
  107. {
  108. g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  109. g.drawImage(HauntedCastle.fireblast2,zombiex+HauntedCastle.panx+15,zombiey+5,Graphics.TOP|Graphics.LEFT );
  110. g.drawImage(HauntedCastle.fireblast2,zombiex+HauntedCastle.panx+15,zombiey+15,Graphics.TOP|Graphics.LEFT );
  111. zd++;
  112. //zombiex-=2;
  113. }
  114. else if(zd==2)
  115. {
  116. g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  117. g.drawImage(HauntedCastle.fireblast3,zombiex+HauntedCastle.panx+15,zombiey,Graphics.TOP|Graphics.LEFT );
  118. g.drawImage(HauntedCastle.fireblast3,zombiex+HauntedCastle.panx+15,zombiey+25,Graphics.TOP|Graphics.LEFT );
  119. zd++;
  120. }
  121. else if(zd==3)
  122. {
  123. // g.drawImage(HauntedCastle.ghost1,zombiex+HauntedCastle.panx,zombiey,Graphics.TOP|Graphics.LEFT );
  124. g.drawImage(HauntedCastle.fireblast3,zombiex+HauntedCastle.panx+15,zombiey,Graphics.TOP|Graphics.LEFT );
  125. g.drawImage(HauntedCastle.fireblast3,zombiex+HauntedCastle.panx+15,zombiey+35,Graphics.TOP|Graphics.LEFT );
  126. zd++;
  127. }
  128. }
  129. }