import java.util.*; import java.awt.*; // // End point of 13-match - Fixed no random object placement // // public class object97 extends object{ // calculate the random cards private static Random random = new Random(); int state=0; long oldtime=0; Image oldimage; // When card is turned it should be put back public object97(){ objnumber=97; methods[0]="hit"; methods[1]="resetevent"; methods[2]="event"; } public void init(Global glbl){ global=glbl; //System.out.println("object 97 init!"); if(image == null){ image=global.loadImage(global.Server, global.Directory+"97"+global.Extention, global.show); oldimage=image; } sound=global.loadSound(global.Server, global.Directory+"99.au"); Date d=new Date(); oldtime=(long)d.getTime(); } public void execute(){ if(method.compareTo("event")==0) event(); if(method.compareTo("resetevent")==0) resetevent(); if(method.compareTo("hit")==0){ hit(); return; } } // Hit the crate/wood public void hit(){ int nr; boolean found=false; for(int i=0; i < 13 && !found; i++){ nr=global.grid.next(0,0,(118+i)); if(nr > -1)found=true; } if(!found){ if(global.playsound)sound.play(); nr=global.grid.next(0,0,97); global.grid.set(nr, 1); global.doboard=true; }else{ global.setInfo("Not all boxes are gone!"); } } public void event(){ } public void resetevent(){ System.out.println("Resetevent on object97"); } // Display public void display(){ global.boardrow=-1; global.boardcol=-1; global.doboard=true; } public int rnd(int rr){ return rand(rr); } public int rand(int seed){ int retval=random.nextInt(seed)+1; return retval; } }