/* SokobanFlob.java * * Copyright (c) 2002, Ayse Cirakoglu * * You may use and distribute under the terms of either the GNU Lesser * General Public License, either version 2 of the license or, * at your choice, any later version. Alternatively, you may use and * distribute under the terms of the XPL. * * See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of * the licenses. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README * file for more details. * */ /* * Written by Ayse Cirakoglu */ package org.gzigzag; import java.awt.*; import java.awt.event.*; import java.util.*; public class SokobanFlob extends CellFlob1 { public static final String rcsid = "$Id: SokobanFlob.java,v 1.1.2.1 2002/10/31 17:05:20 benja Exp $"; public static final boolean dbg = true; Image bilder1,bilder2,bilder3; ZZCell window; public void render(Graphics g, int mx, int my, int md, int mw, int mh) { super.render(g,mx, my, md, mw, mh); //System.out.println("Start render"); Spielplan sp = Spielstand.getSpielstand(window).getSpielplan(); if(sp.hasLagerplatz(c)) { //System.out.println("render yard"); g.drawImage(bilder3,mx+mw/2-mh/2, my, mh, mh, null); } if(sp.hasBox(c)) { g.drawImage(bilder1,mx+mw/2-mh/2, my, mh, mh, null); } else if(sp.getPosition().equals(c)) { g.drawImage(bilder2,mx+mw/2-mh/2, my, mh, mh, null); } //System.out.println("rendered"); } public SokobanFlob(int x, int y, int d, int w, int h, ZZCell c, ZZCell strCell, String s, Font f, FontMetrics fm, ZZCell window) { super(x, y, d, w, h, c,strCell, s, f, fm); Toolkit tk = Toolkit.getDefaultToolkit(); bilder1 = tk.getImage("/home/gzigzag/gzz/Modules/sokoban/box.png"); bilder2 = tk.getImage("/home/gzigzag/gzz/Modules/sokoban/boy.png"); bilder3 = tk.getImage("/home/gzigzag/gzz/Modules/sokoban/yard.png"); this.window = window; } }