import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
public class GamePlayer
{
Image im ;
int x , y ;
public GamePlayer(int _x , int _y)
{
im = Tools.createImageBuyName("player.png");
x = _x ; y = _y ;
}
public void render(Graphics g)
{
g.drawImage(im , x , y , null);
}
public void movePlayer(int dx , int dy,GameBoxManager bm)
{
GameBox box = bm.chack(x+dx, y+dy);
if(box != null)
{
box.moveBox(dx, dy);
}
x += dx ;
y += dy ;
}
}
这段代码是推箱子游戏中玩家