⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 monstersprite.java

📁 j2me RPG手机游戏《征途》的源代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
						}
						if(isWalkable[rdX+1][rdY]){
							x=x+4;
							this.nextFrame();
						}else{
							isSmart=false;
							dir=DIR_LEFT-1;
							this.setFrameSequence(left_seq);
						}
					}else{
						isStop=true;						
						if(isBattle==false){
							isBattle=true;	
							this.setFrameSequence(rightb_seq);
							this.nextFrame();
						}else{
							if(j<stopTime-battleSpeed){
								j++;
								isStopb=true;
								this.setFrameSequence(right);
							}else{
								if(isStopb==true){
									isStopb=false;
									this.setFrameSequence(rightb_seq);
								}								
								if(this.getFrame()==2){
									if(heroHp>0){
										heroHp=heroHp-heroBd;
									}
									j=0;
								}								
								this.nextFrame();
							}
						}
					}
				}
				break;
			case DIR_UP:
				if(!isSmart){
					if(centerDis<moveDis){
						i=0;
						if(isWalkable[ldX][ldY-1] && isWalkable[rdX][rdY-1]){
							this.y=this.y-4;
							this.nextFrame();							
						}else{
							dir=DIR_DOWN-1;
							this.setFrameSequence(down_seq);
						}
						}else{
							this.setFrameSequence(up);
							i++;
							if(i==stopTime){
								tempX=x;
								tempY=y;
								this.chgDir();							
							}
						}
				}else{
					if(!this.collidesWith(heroSprite,true)){
						if(isBattle==true){
							isBattle=false;
							this.setFrameSequence(up_seq);
						}
						if(isStop==true){
							this.setFrameSequence(up_seq);
							isStop=false;
						}
						if(isWalkable[ldX][ldY-1] && isWalkable[rdX][rdY-1]){
							y=y-4;
							this.nextFrame();	
						}else{
							isSmart=false;
							dir=DIR_DOWN-1;
							this.setFrameSequence(down_seq);
						}
					}else{
						isStop=true;						
						if(isBattle==false){
							isBattle=true;							
							this.setFrameSequence(upb_seq);
							this.nextFrame();
						}else{
							if(j<stopTime-battleSpeed){
								j++;
								isStopb=true;
								this.setFrameSequence(up);
							}else{
								if(isStopb==true){
									isStopb=false;
									this.setFrameSequence(upb_seq);
								}								
								if(this.getFrame()==2){
									if(heroHp>0){
										heroHp=heroHp-heroBd;
									}
									j=0;
								}								
								this.nextFrame();
							}
						}
					}
				}
				break;
			case DIR_DOWN:
				if(!isSmart){
					if(centerDis<moveDis){
						i=0;
						if(isWalkable[ldX][ldY+1] && isWalkable[rdX][rdY+1]){
							this.y=this.y+4;
							this.nextFrame();
						}else{
							dir=DIR_UP-1;
							this.setFrameSequence(up_seq);
						}
					}else{
						this.setFrameSequence(down);
						i++;
						if(i==stopTime){
							tempX=x;
							tempY=y;
							this.chgDir();							
						}
					}
				}else{
					if(!this.collidesWith(heroSprite,true)){
						if(isBattle==true){
							isBattle=false;
							this.setFrameSequence(down_seq);
						}
						if(isStop==true){
							this.setFrameSequence(down_seq);
							isStop=false;
						}
						if(isWalkable[ldX][ldY+1] && isWalkable[rdX][rdY+1]){
							y=y+4;
							this.nextFrame();
						}else{
							isSmart=false;
							dir=DIR_UP-1;	
							this.setFrameSequence(up_seq);
						}
					}else{
						isStop=true;						
						if(isBattle==false){
							isBattle=true;							
							this.setFrameSequence(downb_seq);
							this.nextFrame();
						}else{
							if(j<stopTime-battleSpeed){
								j++;
								isStopb=true;
								this.setFrameSequence(down);
							}else{
								if(isStopb==true){
									isStopb=false;
									this.setFrameSequence(downb_seq);
								}								
								if(this.getFrame()==2){
									if(heroHp>0){
										heroHp=heroHp-heroBd;
									}
									j=0;
								}								
								this.nextFrame();
							}
						}
					}
				}
				break;
			case DIR_LU:
				if(!isSmart){
					if(centerDis<moveDis){
						i=0;
						if(isWalkable[ldX-1][ldY] && isWalkable[ldX][ldY-1] && isWalkable[rdX][rdY-1]){
							this.x=this.x-2;
							this.y=this.y-2;
							this.nextFrame();
						}else{
							isSmart=false;
							dir=DIR_RD-1;
							this.setFrameSequence(rd_seq);
						}
					}else{
						this.setFrameSequence(lu);
						i++;
						if(i==stopTime){
							tempX=x;
							tempY=y;
							this.chgDir();							
						}
					}
				}else{
					if(!this.collidesWith(heroSprite,true)){
						if(isStop==true){
							this.setFrameSequence(lu_seq);
							isStop=false;
						}
						if(isBattle==true){
							isBattle=false;
							this.setFrameSequence(lu_seq);
						}
						if(isWalkable[ldX-1][ldY] && isWalkable[luX][ldY-1] && isWalkable[rdX][ruY-1]){
							x=x-2;
							y=y-2;
							this.nextFrame();
						}else{
							isSmart=false;
							dir=DIR_RD-1;
							this.setFrameSequence(rd_seq);
						}													
					}else{
						isStop=true;						
						if(isBattle==false){
							isBattle=true;							
							this.setFrameSequence(lub_seq);
							this.nextFrame();
						}else{
							if(j<stopTime-battleSpeed){
								j++;
								isStopb=true;
								this.setFrameSequence(lu);
							}else{
								if(isStopb==true){
									isStopb=false;
									this.setFrameSequence(lub_seq);
								}								
								if(this.getFrame()==2){
									if(heroHp>0){
										heroHp=heroHp-heroBd;
									}
									j=0;
								}								
								this.nextFrame();
							}
						}
					}
				}
				break;
			case DIR_RU:
				if(!isSmart){
					if(centerDis<moveDis){
						i=0;
						if(isWalkable[ldX][ldY-1] && isWalkable[rdX][rdY-1] && isWalkable[rdX+1][rdY]){
							this.x=this.x+2;
							this.y=this.y-2;
							this.nextFrame();
						}else{
							dir=DIR_LD-1;
							this.setFrameSequence(ld_seq);
						}
					}else{
						this.setFrameSequence(ru);
						i++;
						if(i==stopTime){
							tempX=x;
							tempY=y;
							this.chgDir();							
						}
					}
				}else{
					if(!this.collidesWith(heroSprite,true)){
						if(isStop==true){
							this.setFrameSequence(ru_seq);
							isStop=false;
						}
						if(isBattle==true){
							isBattle=false;
							this.setFrameSequence(rd_seq);
						}
						if(isWalkable[ldX][ldY-1] && isWalkable[rdX][rdY-1] && isWalkable[rdX+1][rdY]){
							x=x+2;
							y=y-2;
							this.nextFrame();
						}else{
							isSmart=false;
							dir=DIR_LD-1;
							this.setFrameSequence(ld_seq);
						}
					}else{
						isStop=true;						
						if(isBattle==false){
							isBattle=true;							
							this.setFrameSequence(rub_seq);
							this.nextFrame();
						}else{
							if(j<stopTime-battleSpeed){
								j++;
								isStopb=true;
								this.setFrameSequence(ru);
							}else{
								if(isStopb==true){
									isStopb=false;
									this.setFrameSequence(rub_seq);
								}								
								if(this.getFrame()==2){
									if(heroHp>0){
										heroHp=heroHp-heroBd;
									}
									j=0;
								}								
								this.nextFrame();
							}
						}
					}
				}					
				break;
			case DIR_RD:
				if(!isSmart){
					if(centerDis<moveDis){
						i=0;
						if(isWalkable[rdX+1][rdY] && isWalkable[ldX][ldY+1] && isWalkable[rdX][rdY+1]){
							this.x=this.x+2;
							this.y=this.y+2;
							this.nextFrame();
						}else{
							dir=DIR_LU-1;
							this.setFrameSequence(lu_seq);
						}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -