import java.util.*; import java.awt.*; public class object167 extends object{ long oldtime=0; int list[]=new int[100]; int list2[]=new int[100]; int listnr=0; int list2nr=0; boolean no=false; int ll=0; int looper=0; private int state=1; private int eventnr=0; private int event1list=0; public object167(){ objnumber=167; methods[0]="hit"; methods[1]="event"; methods[2]="aftermove"; methods[3]="resetevent"; } public void init(Global glbl){ boolean found=false; global=glbl; image=global.loadImage(global.Server,global.Directory+"167"+global.Extention,global.show); sound=global.loadSound(global.Server, global.Directory+"167.au"); Date d=new Date();oldtime=d.getTime(); int nr=-1; listnr=0; nr=0; // change background global.makeBackground(167, image); // Search all buttons while(!found){ nr=global.grid.next(nr==0?0:nr%(global.WIDTH*global.STEPP), nr==0?0:nr/(global.WIDTH*global.STEPP),167); if(nr < 0) found=true; else{ // Add the position to the list list[listnr++]=nr; // Make the object background global.grid.set(nr,1); } nr++; } // Search all the fences found=false; nr=0; while(!found){ nr=global.grid.next(nr==0?0:nr%(global.WIDTH*global.STEPP), nr==0?0:nr/(global.WIDTH*global.STEPP),168); if(nr < 0) found=true; else{ // Add the position to the list list2[list2nr++]=nr; } nr++; } if(listnr < 1) no=true; // No object 10 found on level else no=false; } public void execute(){ if(method.compareTo("aftermove")==0) aftermove(); if(method.compareTo("hit")==0) hit(); if(method.compareTo("resetevent")==0) resetevent(); if(method.compareTo("event") == 0) event(); } public void aftermove(){ } public void hit(){ } public void event1(){ if(no)return; Date d=new Date(); if(d.getTime() < oldtime+800)return; oldtime=d.getTime(); int lnr=0; int p=global.player.getnr(); while(lnr < listnr){ int nr=list[lnr]; int o=global.grid.get(nr); if(o > 1 || p==nr){ System.out.println("Open all fences"); for(int n=0;n