import java.awt.*; public class object95 extends object1{ public Sound squick; public Image image2; public Image image1; public Image image; private Image image3; // 'Calculated'image private Image origbackground; public int other=-1; public int other2=-1; int cc=0; // Calculaged public object95(){ methods[0]="hit"; methods[1]="event1"; methods[2]="event2"; methods[3]="event"; methods[4]="resetevent"; objnumber=95; } // // Used to show the changed image // if we use parent image it will not show anything different // public Image getImage(){return image;} // Use super to use the parent methods public void init(Global glbl){ super.init(glbl); image=global.loadImage(global.Server, global.Directory+objnumber+global.Extention, global.show); squick=global.loadSound(global.Server, global.Directory+objnumber+".au"); } public void execute(){ if(method.compareTo("hit")==0) hit(); if(method.compareTo("event")==0) event(); if(method.compareTo("resetevent")==0) resetevent(); } public void hit(){ super.hit(); if(global.playsound) squick.play(); int nr=global.grid.next(0,0,objnumber); int cw=nr==0?0:((nr)%(global.WIDTH*global.STEPP)); int ch=nr==0?0:((nr )/ (global.WIDTH*global.STEPP)); System.out.println("nr: "+nr+" cw: "+cw+" ch : "+ch); global.grid.setxy(cw,ch,2); // turn on swapping around state=1; global.boardrow=-1; global.boardcol=-1; global.boardwidth=-1; global.boardheight=-1; global.doboard=true; } public void resetevent(){ super.resetevent(); state=0; } public void event1(){ int nr=global.grid.next(0,0,95); if(nr == -1){ // We will change all the positions that the player has with // Stones! int x=global.player.getX(); int y=global.player.getY(); if(x%global.STEPP==0 && y%global.STEPP == 0){ if(global.playsound) squick.play(); global.grid.setxy(x,y, 2); } } } public void event(){ switch(state){ case 1:event1();break; case 2:event2();break; } } }