Scary.java
上传用户:qinghua
上传日期:2022-06-06
资源大小:523k
文件大小:4k
- import javax.microedition.midlet.*;
- import javax.microedition.lcdui.*;
- public class Scary
- {
- public byte sw=0,sd;
- public int moveghost,movez,scaryx,scaryy,walky,zombilevel;
- boolean scarydeadflag;
- boolean ghostdeadflag;
- public Scary(int scaryx,int scaryy){
- this.scaryx = scaryx;
- this.scaryy =scaryy;
-
- }
-
- public void ScaryWalk(Graphics g)
- {
-
- if(sw==0)
- {
- g.drawImage(HauntedCastle.scary1,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- scaryx-=5;
- sw++;
- }
- else if(sw==1)
- {
- g.drawImage(HauntedCastle.scary2,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- sw++;
- scaryx-=5;
- }
- else if(sw==2)
- {
- g.drawImage(HauntedCastle.scary1,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- sw++;
- scaryx-=5;
- }
- else if(sw==3)
- {
- g.drawImage(HauntedCastle.scary2,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- scaryx-=5;
- sw++;
- }
- else if(sw==4)
- {
- g.drawImage(HauntedCastle.scary1,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- sw++;
- scaryx-=5;
- }
- else if(sw==5)
- {
- g.drawImage(HauntedCastle.scary2,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- sw++;
- scaryx-=5;
- }
-
-
- else if(sw==6)
- {
- g.drawImage(HauntedCastle.scary1f,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- sw++;
- scaryx+=5;
- }
- else if(sw==7)
- {
- g.drawImage(HauntedCastle.scary2f,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- sw++;
- scaryx+=5;
- }
- else if(sw==8)
- {
- g.drawImage(HauntedCastle.scary1f,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- sw++;
- scaryx+=5;
- }
- else if(sw==9)
- {
- g.drawImage(HauntedCastle.scary2f,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- sw++;
- scaryx+=5;
- }
- else if(sw==10)
- {
- g.drawImage(HauntedCastle.scary1f,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- sw++;
- scaryx+=5;
- }
- else if(sw==11)
- {
- g.drawImage(HauntedCastle.scary2f,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- sw=0;
- scaryx+=5;
- }
-
- }
-
-
- public void ScaryDies(Graphics g)
- {
- /* if(zombiy==2)
- zombilevel=54;
- else
- zombilevel=158;*/
-
- if(sd==0)
- {
- g.drawImage(HauntedCastle.scary1,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast1,scaryx+HauntedCastle.panx+7,scaryy+10,Graphics.TOP|Graphics.LEFT );
-
- sd++;
- }
- else if(sd==1)
- {
- g.drawImage(HauntedCastle.scary1,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast2,scaryx+HauntedCastle.panx+7,scaryy+5,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast2,scaryx+HauntedCastle.panx+7,scaryy+15,Graphics.TOP|Graphics.LEFT );
- sd++;
- //scaryx-=2;
- }
- else if(sd==2)
- {
- g.drawImage(HauntedCastle.scary1,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,scaryx+HauntedCastle.panx+7,scaryy,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,scaryx+HauntedCastle.panx+7,scaryy+25,Graphics.TOP|Graphics.LEFT );
- sd++;
-
- }
- else if(sd==3)
- {
- // g.drawImage(HauntedCastle.ghost1,scaryx+HauntedCastle.panx,scaryy,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,scaryx+HauntedCastle.panx+7,scaryy,Graphics.TOP|Graphics.LEFT );
- g.drawImage(HauntedCastle.fireblast3,scaryx+HauntedCastle.panx+7,scaryy+35,Graphics.TOP|Graphics.LEFT );
- sd++;
-
- }
-
- }
- }