質問編集履歴

1

ソース修正

2018/07/12 09:57

投稿

michael-ilcsy
michael-ilcsy

スコア180

test CHANGED
File without changes
test CHANGED
@@ -4,19 +4,25 @@
4
4
 
5
5
  public abstract class Shot {
6
6
 
7
- protected static int width;
7
+ protected static int x;
8
8
 
9
- protected static int height;
9
+ protected static int y;
10
+
11
+   // 弾の画像
12
+
13
+ protected Image image;
14
+
15
+
10
16
 
11
17
 
12
18
 
13
- public void draw(){
19
+ public void draw(Graphics g){
14
20
 
15
- //処理省略
21
+ g.drawImage(image, x, y, null);
16
22
 
17
23
  }
18
24
 
19
- //その他メソッド等省略
25
+ //その他メソッド,フィールド等省略してます
20
26
 
21
27
  }
22
28
 
@@ -40,9 +46,9 @@
40
46
 
41
47
  ↓パネルでの描画メソッド
42
48
 
43
- public void draw (Shot shot) {
49
+ public void draw (Shot shot,Graphics g) {
44
50
 
45
- shot.draw();
51
+ shot.draw(g);
46
52
 
47
53
  }
48
54