import java.net.*; import java.io.*; import java.awt.*; import java.util.*; import java.awt.image.*; public class Global{ Image background=null; // complete background image Graphics backgroundcanvas=null; // to draw on the background Image backgroundlow=null; // The lower part of the background Image menu[]=new Image[1500]; int MAXOBJECTS=1050; Image objects[]=new Image[MAXOBJECTS]; Point objectpoints[]=new Point[MAXOBJECTS]; int objectwidth[]=new int[MAXOBJECTS]; int nrofobjects=0; Sound backgroundsound=null; int playerstate=0; // 0 is walk, 1 is push ..etc.. int MAXPLAYERSTATES=2; int stepcounter=0; int screenpage=0; // Level selector int sleep=24; // main run-loop sleeper int frameticker=0; Stack undostack=new Stack(); int undocounter=0; int framenr=0; GameObject gameobject[]=new GameObject[MAXOBJECTS]; FIFO dirtystack=new FIFO(); Hashtable properties=new Hashtable(); AnimationStack animationstack=new AnimationStack(this); ContinuousAnimationStack continuousanimation=new ContinuousAnimationStack(this); Image buttonimage[]=new Image[15]; public int MAXW=15; public int MAXH=10; public int MAXFRAMES=8; public int FRAMESTEP=1; //must be able to divide / maxframes public int _grid[][]=new int[(MAXH+1)][(MAXW+1)]; int levelobjects[]=new int[MAXH*MAXW]; int objectloadnr=0; // index of loading objects int objectloadcounter=0; // maximum number of objects in level Grid grid=new Grid(this); aGame game; boolean standalone=true; boolean playsound=false; boolean firsttime=true; // Is it the first time that we draw? // Background above parts int State=0; int oldobject=1; // what kind of object is under the playersfeet? boolean pass=false; // can we go on the object? border is one of those String Server=""; String Directory="/objects/"; String Extention=".gif"; int OFFSETX=0; int OFFSETY=430; int TILEWIDTH=48; int TILEHEIGHT=48; int TILESIZE=48; boolean TILEANIMATED=true; int TILEFRAMES=MAXFRAMES; int PLAYERFRAMES=8; int TILESTEPS=TILESIZE/TILEFRAMES; public int playerx=0; public int playery=(OFFSETY/TILESIZE)*MAXFRAMES; public int playerxstored=0; public int playerystored=0; // stepcounter changes when position changes. begin applet; int INIT=0; int LOAD=1; int DRAW=2; int BEFOREDRAW=3; int MENU = 1000; int MENU1 = 1001; int level=1; int usernr=1000; int dir=0; boolean changed=false; Hashtable imagehash=new Hashtable(); FIFO KeyStack=new FIFO(); public Global(aGame gm){ game=gm; applet=game.applet; // // OBSOLETE // // Tell the applet that we want // // a static message .. // // this is because the next stages // // 'freezes' the application and the // // ProgressionBar does not want to move // // anymore!!! // applet.state=1; Server=game.applet.getCodeBase().toString(); if(Server.indexOf("http") > -1) standalone=false; else standalone=true; // // Buttons // while(buttonimage[0] == null){ buttonimage[0] = loadImage(Server, "buttons/levels.gif", game); } while(buttonimage[1] == null){ buttonimage[1] = loadImage(Server, "buttons/undo.gif", game); } while(buttonimage[2] == null){ buttonimage[2] = loadImage(Server, "buttons/restart.gif", game); } State=INIT; } public void init(){ // initializing State=LOAD; // State=MENU1; } public void loading(){ if(usernr++ > 10002)usernr=10000; switch(usernr){ case 10001: TILEWIDTH=200; TILEHEIGHT=168; TILEANIMATED=true; TILEFRAMES=MAXFRAMES; TILESTEPS=TILEWIDTH/TILEFRAMES; break; case 10000: TILEWIDTH=50; TILEHEIGHT=100; TILEANIMATED=true; TILEFRAMES=MAXFRAMES; TILESTEPS=TILEWIDTH/TILEFRAMES; break; case 10002: TILEWIDTH=113; TILEHEIGHT=69; TILEANIMATED=true; TILEFRAMES=MAXFRAMES; TILESTEPS=TILEWIDTH/TILEFRAMES; break; case 10003: TILEWIDTH=105; TILEHEIGHT=61; TILEANIMATED=true; TILEFRAMES=MAXFRAMES; TILESTEPS=TILEWIDTH/TILEFRAMES; break; } load(); } public void load(){ // loading of the level // userimg, background int objnr=0; animationstack.clear(); resetundo(); objectloadcounter=0; objectloadnr=0; // obsolete ... objects=new Image[MAXW*MAXH]; Image backgroundg=loadImage(Server,"backgrounds/level"+level+".gif",game); if(backgroundg==null){ backgroundg=loadImage(Server,"backgrounds/level1.gif",game); } if(backgroundsound != null) backgroundsound.stop(); backgroundsound=loadSound(Server, "music/level"+level+".au"); Image bg=game.createImage(1024,768); backgroundcanvas=bg.getGraphics(); backgroundcanvas.drawImage(backgroundg,0,0,game); background=bg; applet.repaint(); // make the lower part of the background // backgroundlow=game.createImage(1024,879); // Graphics backgroundlowcanvas=backgroundlow.getGraphics(); // backgroundlowcanvas.drawImage(background, 0, -OFFSETY, game); applet.repaint(); // standing still // Get objects from the level file getObjects(); // reset all objects (now all objects are in maze) // so we can count our objects etc.. for(int i=0; i < MAXOBJECTS; i++){ if(gameobject[i]!=null){ gameobject[i].setMethod("resetevent"); gameobject[i].execute(); } } // now make sure that we don't have undo's left: resetundo(); game.loadPlayer(); // set the focus (for the keys) game.hidden.requestFocus(); State=BEFOREDRAW; changed=true; // is something So that we can draw? } // Execute PHP scripts // public String execute(String php){ String retval=""; String test=new String(""); Integer I; Integer J; String inputLine; Date d=new Date(); if(!standalone){ try{ URL Url = new URL(Server+php+"&dummy="+d.getTime()); if(Url.toString().indexOf("file") > -1){ standalone=true; }else{ URLConnection uc = Url.openConnection(); BufferedReader in = new BufferedReader( new InputStreamReader( uc.getInputStream() ) ); while ((inputLine = in.readLine()) != null){ // Script is executing .. no output is given! retval+=inputLine; } } // else is file --> standalone? }catch(Exception ef){ System.out.println("Error getting result from: "+php+" : "+ef.toString()); standalone=false; retval=""; } } return retval; } // // JAR .. // Check the code to load a jar // // // HashTable with images .. // // Quick access to image // public Image loadImage(String Server, String filename, Component comp){ Image retval=null; // First search for the Server+filename in the stack retval=(Image)imagehash.get(Server+filename); // IF we are in a JAR then we assume that I need an extraction of this JAR String path; try{ path=System.getProperty("java.class.path"); }catch(Exception exception12){ path=""; } if(retval==null && path.indexOf("jar") >-1){ MediaTracker mt; Image img=null; String vv=filename.substring(1,filename.length()); System.out.println("loadingvv: ["+vv+"]"); try{ URL url=getClass().getClassLoader().getResource(vv); System.out.println("URL vv: ["+url.toString()+"]"); retval=Toolkit.getDefaultToolkit().getImage(url); if(retval!=null ){ mt = new MediaTracker(comp); mt.addImage( retval, 0 ); mt.waitForAll(); } }catch(Exception eggegeg){retval=null;} } if(retval==null){ // if not found in stack -> read from network retval=readImage(Server, filename, comp); } if(retval!=null){ System.out.println("Loaded image :"+Server+filename); imagehash.put(Server+filename, (Image)retval); } return retval; } // // Applet read of image // private Image readImage(String Server, String filename, Component comp){ MediaTracker mt; Image img=null; Date d=new Date(); URL url; boolean no_error=true; try{ // TODO: // Add dummy to the URL so that it won't cache! url=new URL(Server+filename); applet.repaint(); if(url != null){ InputStream ia = url.openStream(); BufferedReader in = new BufferedReader(new InputStreamReader(ia)); String inputLine; if((inputLine = in.readLine()) == null ) no_error=false; else{ // If there is a 404 page -> not an image! if(inputLine.toUpperCase().indexOf("HTTP") > -1) no_error=false; else no_error=true; } in.close(); if(no_error){ try{ img=Toolkit.getDefaultToolkit().getImage(url); }catch(Exception eggegeg){img=null;no_error=false;} if(img!=null && no_error){ mt = new MediaTracker(comp); mt.addImage( img, 0 ); mt.waitForAll(); }else no_error=false; } } // if error URL IS NULL } catch (Exception ef) { System.out.println("error oading image: "+ef.toString()); no_error=false; } // test size if(img != null && no_error){ if(img.getWidth(comp) < 0 || img.getHeight(comp) < 0) img=null; } mt = null; if(!no_error)img=null; return img; } // -- // getboardImage // get a piece of // -- public Image getBackground(Point start, Point end){ Image retval=null; if(game != null){ if(game.canvas != null){ retval=game.createImage(end.x - start.x, end.y - start.y); Graphics rr=retval.getGraphics(); rr.drawImage(game.buffer, -start.x, -start.y, game); } } return retval; } /* // -- // change Background // -- public void changeBackground(Image img, Point pos){ Image cbackground=game.createImage(1024,800); Graphics cgraphics=cbackground.getGraphics(); int x,y; x=pos.x; y=pos.y; int w=TILEWIDTH/STEPS; if(cgraphics != null){ if(background!=null)cgraphics.drawImage(background, 0,0, game); if(img!=null){ cgraphics.drawImage(img, x*w,y*w, TILEWIDTH, TILEHEIGHT, game); } background=cbackground; } if(cgraphics != null){ cgraphics.dispose(); } // doboard=true; } // // Changebackground with two images // // - img=object to be put on obj image // - obj=first object on background public void changeBackground(Image img, Image obj,Point pos){ Image cbackground=game.createImage(1024,800); Graphics cgraphics=cbackground.getGraphics(); int x,y; x=pos.x; y=pos.y; int w=TILEWIDTH/STEPS; if(cgraphics != null){ if(background!=null)cgraphics.drawImage(background, 0,0, game); if(obj!=null)cgraphics.drawImage(obj, x*w,y*w, TILEWIDTH, TILEHEIGHT, game); if(img!=null)cgraphics.drawImage(img, x*w,y*w, TILEWIDTH, TILEHEIGHT, game); background=cbackground; }else System.out.println("Graphics on changebackground is null!!!"); if(cgraphics != null) cgraphics.dispose(); // doboard=true; } */ public Image rotate(Image src){ Image retval=null; // rotate image src retval=src; return retval; } public Image trans(Image bi) { int width = bi.getWidth( game); int height= bi.getHeight( game); int[] pgPixels = new int[height* width]; PixelGrabber pg = new PixelGrabber(bi, 0, 0, width, height, pgPixels, 0,width); try { pg.grabPixels(); } catch (InterruptedException e) { e.printStackTrace(); } // try for (int y = 0; y > 24; int r = (pgPixels[i] & 0x00ff0000) >> 16; int g = (pgPixels[i] & 0x0000ff00) >> 8; int b = pgPixels[i] & 0x000000ff; if (r >= 210 && g >= 0 && b >= 210) { a = 0; pgPixels[i] = a | (r << 16) | (g << 8) | b; } // if pink? } // for x } // for y Image _i = game.createImage(new MemoryImageSource(width, height, pgPixels, 0,width)); return _i; }//trans // flip an image horizontally public Image flip(Image theImage) { Image retval=null; // load the image pixels into the imagePixels array int nw = theImage.getWidth(null); int nh = theImage.getHeight(null); retval=game.createImage(nw,nh); Graphics c=retval.getGraphics(); c.drawImage(theImage, 0,0, game); return retval; } // // load level - objects // public void getObjects(){ String X,Y,OBJ=""; int x,y,objnr=0; String inputLine; BufferedReader in; X="";Y="";OBJ=""; x=0;y=0;objnr=0; usernr=0; stepcounter=0; // TELL THE SCREEN TO REDRAW BACKGROUND firsttime=true; try{ URL u = new URL(Server+"/levels/level"+level+".dat"); InputStream ia = u.openStream(); in = new BufferedReader(new InputStreamReader(ia)); // if we have new screen reset the firezones nrofobjects=0; for(int ii=0; ii 0){ StringTokenizer st=null; if(inputLine.trim().indexOf(",")>-1){ st=new StringTokenizer(inputLine.trim(), ","); } if(st!=null){ Integer I=new Integer(1); try{ if(st.hasMoreTokens()){ Y=st.nextToken(); } if(st.hasMoreTokens()){ X=st.nextToken(); } if(st.hasMoreTokens()){ OBJ=st.nextToken(); } try{ Integer XI=new Integer(X); Integer YI=new Integer(Y); Integer OBJNRI=new Integer(OBJ); x=XI.intValue(); y=YI.intValue(); objnr=OBJNRI.intValue(); if(objnr<1)objnr=1; }catch(Exception exception1){ I=new Integer(0); } }catch(Exception exception){ // ignore objects will just be empty = background } if(I.intValue() > 0){ //System.out.println("Object : "+objnr); // loadObject(objnr, x, y); boolean found=false; for(int k=0; k < objectloadcounter; k++){ if(levelobjects[k]==objnr)found=true; } if(!found) levelobjects[objectloadcounter++]=objnr; //System.out.println("Unique objects: "+objectloadcounter); // For each user // make playerx array so that we // can track the rest of the players .. // The arrows on the floor determine the direction // so we need to keep track of the colored arrows if(objnr > 999 && usernr==0){ playerx=x*MAXFRAMES; playery=y*MAXFRAMES; playerxstored=playerx; playerystored=playery; usernr=objnr; } // object user? // add to grid if( y < MAXH && x < MAXW) grid.setyx(y*MAXFRAMES,x*MAXFRAMES,objnr); } // if objectnr }// if stringtokenizer } // if inputline is not empty } // while not eof in.close(); }catch(Exception e){ System.out.println("\nText Read Error:level="+level+"error: "+e.toString()+"\n"); } for(int i=0; i < 4; i++){ objnr=i+1; } changed=true; } public Sound loadSound(String Server, String filename){ Sound retval=null; try{ retval=new Sound(applet); retval.load(Server+filename); }catch(Exception e){ System.out.println("loadSound exc: "+e.toString()); } return retval; } // // Load Object into memory and initialize it! // public void loadObject(int objnr){ try{ if(gameobject[objnr]==null){ // dynamic load //System.out.pri ntln("forname: object"+objnr); Class c=Class.forName("object"+objnr); if(c != null){ System.out.println("Going to newInstance .."); gameobject[objnr]=(GameObject)c.newInstance(); if(gameobject[objnr]!= null){ //System.out.println("We have an instance!"); gameobject[objnr].init(this); gameobject[objnr].setMethod("resetevent"); gameobject[objnr].execute(); } } // c != null } // if gameobject not known }catch(Exception e){ System.out.println("Error in loadObject: "+e.toString()); } } // loaObject // // resetundo // public void resetundo(){ // // make sure that there are no undos .. // otherwise you will do undos from previous level / state // stepcounter=0; while(!undostack.isEmpty()){ String popper=(String)undostack.pop(); } undostack.clear(); } public String getProperty(String prop){ System.out.println("GetPoperty called"); String retval=(String)properties.get(prop); if(retval==null)retval=new String(""); return retval; } public void setProperty(String prop, String val){ System.out.println("Setting: "+prop+"to VaL:"+val); properties.put(prop, new String(val)); } public long getTime(){ long retval=0; Date date=new Date(); retval=date.getTime(); return retval; } public void changeBackground(int y, int x, String img){ Image image; int cy=y==0?0:y/MAXFRAMES; int cx=x==0?0:x/MAXFRAMES; image=loadImage(Server, Directory+img+Extention,game); if(image!=null){ backgroundcanvas.drawImage(image, cx*TILESIZE,cy*TILESIZE, game); } // grid.setyx(y,x,1); game.redraw(y,x); } // Canon fire - range // or position on border public boolean preventmovepush(int y, int x, int dir){ boolean retval=false; switch(dir){ case 1: // up if(oncol(x,y-MAXFRAMES))retval=true; break; case 3: // down if(oncol(x,y+MAXFRAMES))retval=true; break; case 0: // right if(onrow(x+MAXFRAMES,y))retval=true; break; case 2: // left if(onrow(x-MAXFRAMES,y))retval=true; break; } return retval; } // preventmovepush // // canon in range when we move? // public boolean preventmove(int y, int x, int dir){ boolean retval=false; // check if the next position is on a hit-path switch(dir){ case 0: //right; if(x > ((MAXFRAMES*MAXW)-MAXFRAMES)){ retval=true; }else if(oncol(x+MAXFRAMES,y))retval=true; break; case 1: //up if(y ((MAXFRAMES*MAXH)-MAXFRAMES)){ retval=true; } else{ if(onrow(x,y+MAXFRAMES)){ retval=true; } } break; } return retval; } public boolean oncol(int x, int y){ boolean retval=false; // check above and below x for a 8 or 9 object // // above //System.out.println(" X: "+x+" y: "+y); for(int i=y-MAXFRAMES; i>-1 && !retval; i-=MAXFRAMES){ int obj=grid.getobject(i,x); //System.out.println(" obj: "+obj); // object in between found if(obj > 1 ){ switch(obj){ case 9: case 10: // flash canon for(int f=0; f<5; f++){ animationstack.add(frameticker++,i,x, obj,f,"false",dir, i,x); animationstack.add(frameticker++,i,x, 1,f,"false",dir, i,x); animationstack.add(frameticker++,i,x, obj,f,"false",dir, i,x); } retval=true; break; case 4: // hole case 3: // water // go on checking break; default: i=-1; break; } } } // down for(int i=y+MAXFRAMES; i<(MAXH*MAXFRAMES)+MAXFRAMES && !retval; i+=MAXFRAMES){ int obj=grid.getobject(i,x); // object in between found if(obj > 1 ){ switch(obj){ case 8: //canonup case 10: // multicanon // flash canon for(int f=0; f<5; f++){ animationstack.add(frameticker++,i,x, obj,f,"false",dir, i,x); animationstack.add(frameticker++,i,x, 1,f,"false",dir, i,x); animationstack.add(frameticker++,i,x, obj,f,"false",dir, i,x); } retval=true; break; case 4: // hole case 3: // water // go on checking break; default: i=(MAXH*MAXFRAMES)+MAXFRAMES; break; } } } return retval; } public boolean onrow(int x, int y){ boolean retval=false; // check left and right x for a 6 or 7 object // // search to the left //System.out.println(" X: "+x+" y: "+y); for(int i=x-MAXFRAMES; i>-1 && !retval; i-=MAXFRAMES){ int obj=grid.getobject(y,i); //System.out.println(" obj: "+obj); // object in between found if(obj > 1 ){ switch(obj){ case 6: // canonright case 10: // flash canon for(int f=0; f<5; f++){ animationstack.add(frameticker++,y,i, obj,f,"false",dir, y,i); animationstack.add(frameticker++,y,i, 1,f,"false",dir, y,i); animationstack.add(frameticker++,y,i, obj,f,"false",dir, y,i); } retval=true; break; case 4: // hole case 3: // water // go on checking -- canon can hit break; default: i=-1; break; } // switch } // if obj } // for each col for(int i=x+MAXFRAMES; i<(MAXW*MAXFRAMES)+MAXFRAMES && !retval; i+=MAXFRAMES){ //System.out.println("Before obj getobj"); int obj=grid.getobject(y,i); //System.out.println("obj: "+obj); // object in between found if(obj > 1 ){ switch(obj){ case 7: // canonleft case 10: // multicanon //System.out.println(" HIT !!!"); // flash canon for(int f=0; f<5; f++){ animationstack.add(frameticker++,y,i, obj,f,"false",dir, y,i); animationstack.add(frameticker++,y,i, 1,f,"false",dir, y,i); animationstack.add(frameticker++,y,i, obj,f,"false",dir, y,i); } retval=true; break; case 4: // hole case 3: // water // go on checking -- canon can hit break; default: i=(MAXW*MAXFRAMES)+MAXFRAMES; break; } //switch } // if obj } // for each col //System.out.println( "retval : "+retval); return retval; } // onrow // pushing object to left/right/up/down // // This happens so often in the game, it got global // methods. //*** // Push (stone, wood ...) //*** public void left_push(int obj,int objectframes){ int animationframe=0; playerstate=1; // push dir=2; // left direction if(preventmove(playery, playerx, dir))return; // Get object behind rock int nextobj=grid.getobject(playery, playerx-(MAXFRAMES*2)); switch(nextobj){ case 1: if(nextobj > 1){ if(preventmovepush(playery,playerx-(MAXFRAMES*1), dir)){ return; } } grid.setyx(playery,playerx,oldobject); grid.setyx(playery,playerx-MAXFRAMES,1); dir=2; // left direction for(int i=0; i objectframes-1)animationframe=0; String action=""; // end of animation .. what do we do next? action="true"; animationstack.add(frameticker,playery, playerx-i-MAXFRAMES, obj ,animationframe,action, dir, playery, playerx-MAXFRAMES); animationstack.add(frameticker++,playery, playerx-i, usernr,animationframe,i==MAXFRAMES?"true":"false", dir, playery, playerx); } // for break; default: // we push against something // nextobj --> object to call the push method gameobject[nextobj].setMethod("push"); gameobject[nextobj].setArg(0,""+playery); gameobject[nextobj].setArg(1,""+(playerx-(MAXFRAMES*2))); gameobject[nextobj].execute(); break; } // switch } // right pusing public void right_push(int obj,int objectframes){ int animationframe=0; playerstate=1; dir=0; int nextobj=grid.getobject(playery, playerx+(MAXFRAMES*2)); if(nextobj < 0) return; switch(nextobj){ case 1: if(nextobj > 1){ if(preventmovepush(playery,playerx+(MAXFRAMES*1), dir)){ return; } } grid.setyx(playery,playerx,oldobject); grid.setyx(playery,playerx+MAXFRAMES,oldobject); dir=0; // left direction for(int i=0; i objectframes-1)animationframe=0; animationstack.add(frameticker,playery, playerx+i+MAXFRAMES, obj ,animationframe,i==MAXFRAMES?"true":"false", dir, playery, playerx+MAXFRAMES); animationstack.add(frameticker++,playery, playerx+i, usernr,animationframe,i==MAXFRAMES?"true":"false", dir, playery, playerx); } // for break; default: // we push against something // nextobj --> object to call the push method gameobject[nextobj].setMethod("push"); gameobject[nextobj].setArg(0,""+playery); gameobject[nextobj].setArg(1,""+(playerx+(MAXFRAMES*2))); gameobject[nextobj].execute(); break; } // switch } public void up_push(int obj,int objectframes){ int animationframe=0; playerstate=1; dir=1; int nextobj=grid.getobject(playery-(MAXFRAMES*2), playerx); switch(nextobj){ case 1: if(nextobj > 1){ if(preventmovepush(playery-(MAXFRAMES*1), playerx, dir)){ return; } } // System.out.println("Pusing "+obj+" to up"); grid.setyx(playery,playerx,oldobject); grid.setyx(playery-MAXFRAMES,playerx,oldobject); dir=1; // up direction for(int i=0; i objectframes-1)animationframe=0; animationstack.add(frameticker,playery-i-MAXFRAMES,playerx, obj ,animationframe,i==MAXFRAMES?"true":"false", dir, playery-MAXFRAMES,playerx); animationstack.add(frameticker++,playery-i,playerx, usernr,animationframe,i==MAXFRAMES?"true":"false", dir, playery, playerx); } // for break; default: // we push against something // nextobj --> object to call the push method gameobject[nextobj].setMethod("push"); gameobject[nextobj].setArg(0,""+(playery-(MAXFRAMES*2))); gameobject[nextobj].setArg(1,""+playerx); gameobject[nextobj].execute(); break; } // switch } public void down_push(int obj,int objectframes){ int animationframe=0; playerstate=1; dir=3; int nextobj=grid.getobject(playery+(MAXFRAMES*2), playerx); switch(nextobj){ case 1: if(nextobj > 1){ if(preventmovepush(playery+(MAXFRAMES*1), playerx, dir)){ return; } } grid.setyx(playery,playerx,oldobject); grid.setyx(playery+MAXFRAMES,playerx,oldobject); dir=3; // down direction for(int i=0; i objectframes-1)animationframe=0; animationstack.add(frameticker,playery+i+MAXFRAMES,playerx, obj ,animationframe,i==MAXFRAMES?"true":"false", dir, playery+MAXFRAMES,playerx); animationstack.add(frameticker++,playery+i,playerx, usernr,animationframe,i==MAXFRAMES?"true":"false", dir, playery, playerx); } // for break; default: // we push against something // nextobj --> object to call the push method gameobject[nextobj].setMethod("push"); gameobject[nextobj].setArg(0,""+(playery+(MAXFRAMES*2))); gameobject[nextobj].setArg(1,""+playerx); gameobject[nextobj].execute(); break; } // switch } // downpush }