import java.util.*; import java.awt.*; // // Torch // // No fire - torch // // torch => fire ==> firetorch (59) // // firetorch can be used to put grass on fire // // Maybe even wood // public class object59 extends object{ private General general; int state=0; boolean debug=false; Sound splash; public object59(){ objnumber=59; methods[0]="hit"; methods[1]="action1"; methods[2]="action3"; methods[3]="action4"; methods[4]="event"; methods[5]="action178"; //stroh(curled up grass) -> turn into fire } public void init(Global glbl){ global=glbl; image=global.loadImage(global.Server, global.Directory+"59"+global.Extention, global.show); sound=global.loadSound(global.Server, global.Directory+"59.au"); // turn on flame = grass splash=global.loadSound(global.Server, global.Directory+"3.au"); // turn off flame 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("action178")==0) action178(); 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, 59); // 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(){ // Turn to 49 object int x,y; x=global.player.getX(); y=global.player.getY(); if(global.dir == -global.STEPP){ global.grid.setxy(x-global.STEPP, y,49); } // Right if(global.dir == global.STEPP){ global.grid.setxy(x+global.STEPP, y,49); } // down if(global.dir == global.STEPP*global.WIDTH){ global.grid.setxy(x, y+global.STEPP,49); } // up if(global.dir == -global.STEPP*global.WIDTH){ global.grid.setxy(x, y-(global.STEPP),49); } if(global.playsound) splash.play(); global.freeze=false; global.PLAYERSTATE=0; global.aftermoves=true; global.boardrow=-1; global.boardcol=-1; global.doboard=true; state=43; } 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 action178(){ 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,177); global.grid.setxy(x-global.STEPP, y,49); } // Right if(global.dir == global.STEPP){ global.grid.setxy(x+global.STEPP+global.STEPP, y,177); global.grid.setxy(x+global.STEPP, y,49); } // down if(global.dir == global.STEPP*global.WIDTH){ global.grid.setxy(x, y+global.STEPP+global.STEPP,177); global.grid.setxy(x, y+global.STEPP,49); } // up if(global.dir == -global.STEPP*global.WIDTH){ global.grid.setxy(x, y-(global.STEPP+global.STEPP),177); global.grid.setxy(x, y-(global.STEPP),49); } 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==59 && 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 } }