import java.util.*; import java.awt.*; // // Puzzle pushing .. // // 9 puzzle part // public class object85 extends object{ int state=0; int o1=0; int i1=0; public object85(){ objnumber=85; methods[0]="hit"; methods[1]="action1"; methods[2]="action3"; methods[3]="action4"; methods[4]="aftermove"; methods[5]="event"; methods[6]="resetevent"; } public void init(Global glbl){ global=glbl; super.init(global); general=new General(global,getNr()); } public void execute(){ if(method.compareTo("action1")==0) action1(); if(method.compareTo("action3")==0) action3(); if(method.compareTo("action4")==0) action4(); if(method.compareTo("event")==0) event(); if(method.compareTo("hit")==0){ hit(); return; } if(method.compareTo("aftermove")==0){ aftermove(); } } public void aftermove(){ } public void hit(){ i1=general.getImageBehind(); int x,y; x=global.player.getX(); y=global.player.getY(); global.grid.setxy(x,y,objnumber); if(global.dir == -global.STEPP){ global.player.set(x-global.STEPP, y); global.grid.setxy(x-global.STEPP, y,i1); } // Right if(global.dir == global.STEPP){ global.player.set(x+global.STEPP, y); global.grid.setxy(x+global.STEPP, y,i1); } // down if(global.dir == global.STEPP*global.WIDTH){ global.player.set(x, y+global.STEPP); global.grid.setxy(x, y+global.STEPP,i1); } // up if(global.dir == -global.STEPP*global.WIDTH){ global.player.set(x, y-global.STEPP); global.grid.setxy(x, y-(global.STEPP),i1); } if(global.playsound && sound!=null) sound.play(); global.freeze=false; global.PLAYERSTATE=0; global.aftermoves=true; global.boardrow=-1; global.boardcol=-1; global.doboard=true; state=43; } // Action methods public void action3(){ } public void action4(){ } public void action1(){ state=1; } // Action methods public void event1(){ if(general != null) state=general.push(state); } public void event2(){ global.freeze=false; global.resetevent=true; global.waitforme=false; global.aftermoves=true; global.State=global.NOTHING; state=3; } public void event(){ // put everything here like a 'run' method switch(state){ case 1: event1(); break; case 2: event2();break; } } public void resetevent(){ if(global.perform) if(global.STEPP==1) state=0; else state=1; } }