import java.util.*; import java.awt.*; // // Pair object -> 61 - 60 // // Long Grass and Sickel // // Sickel // public class object60 extends object{ private General general; int state=0; boolean debug=false; Sound splash; public object60(){ objnumber=60; methods[0]="hit"; methods[1]="action1"; methods[2]="action3"; methods[3]="action4"; methods[4]="event"; methods[5]="action61"; } public void init(Global glbl){ global=glbl; image=global.loadImage(global.Server, global.Directory+"60"+global.Extention, global.show); sound=global.loadSound(global.Server, global.Directory+"60.au"); splash=global.loadSound(global.Server, global.Directory+"3.au"); general=new General(global,getNr()); } public void execute(){ if(method.compareTo("event")==0) event(); if(method.compareTo("resetevent")==0) resetevent(); if(method.compareTo("event1")==0) event1(); if(method.compareTo("action1")==0) action1(); if(method.compareTo("action3")==0) action3(); if(method.compareTo("action4")==0) action4(); if(method.compareTo("action61")==0) action61(); if(method.compareTo("hit")==0){ hit(); return; } } public void hit(){ int o1=general.getBehind(); String l="action"+o1; if(is(l)){ setMethod(l); execute(); } } public void action1(){ state=1; } // Action methods public void event1(){ if(general != null) state=general.push(state); } public void event2(){ global.freeze=false; global.aftermoves=true; state=3; } // Action methods public void oldaction1(){ // Stone pushing!! global.grid.set(global.player.get()+global.dir, 1); global.grid.set(global.player.get()+global.dir+global.dir, 60); // Animation when needed!! global.pushed=global.player.get()+global.dir+global.dir; global.State=global.PUSH; global.player.set(global.dir); //global.oldPlayerPos=global.PlayerPos; //global.PlayerPos+=global.dir; } public void action3(){ // when saw is pushed into WATER if(global.playsound) splash.play(); global.PLAYERSTATE=1; state=general.throwit(state); global.freeze=false; global.aftermoves=true; state=33; } public void action4(){ // when saw is pushed into HOLE global.PLAYERSTATE=1; state=general.throwit(state); global.freeze=false; global.aftermoves=true; state=33; } public void action61(){ int x,y; x=global.player.getX(); y=global.player.getY(); if(global.dir == -global.STEPP){ global.grid.setxy(x-global.STEPP-global.STEPP, y,178); } // Right if(global.dir == global.STEPP){ global.grid.setxy(x+global.STEPP+global.STEPP, y,178); } // down if(global.dir == global.STEPP*global.WIDTH){ global.grid.setxy(x, y+global.STEPP+global.STEPP,178); } // up if(global.dir == -global.STEPP*global.WIDTH){ global.grid.setxy(x, y-(global.STEPP+global.STEPP),178); } 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; } public void resetevent(){ if(global.object==60 && global.perform) state=1; } public void event(){ // put everything here like a 'run' method switch(state){ case 1: event1(); break; case 2: event2(); break; } // draw image } }