- 【初心者】スレを立てる前にココで質問を【Part24】
825 :名前は開発中のものです。[sage]:2012/12/18(火) 04:54:43.47 ID:yE3xa8xm - public class Bom {
public int x, y; private Image bomImage; public Bom(int x, int y, Player player) { this.x = player.x; this.y = player.y; if(bomImage == null) loadImage(); } public void loadImage() { ImageIcon icon = new ImageIcon("res/img/bom.png"); bomImage = icon.getImage(); } public void draw(Graphics g) { g.drawImage(bomImage, x, y, null); } } >>824 ここでPlayerクラスのx, yを利用するのはよくないですか?
|