Skip to content

Commit 6dc274f

Browse files
authored
Add files via upload
1 parent d255ea3 commit 6dc274f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1398
-0
lines changed
1.25 KB
Binary file not shown.

STG_A18/bin/jp/tnw/A18/Bomb.class

2.82 KB
Binary file not shown.

STG_A18/bin/jp/tnw/A18/Bullet.class

3.91 KB
Binary file not shown.

STG_A18/bin/jp/tnw/A18/Bullet2.class

3.54 KB
Binary file not shown.

STG_A18/bin/jp/tnw/A18/Enemy.class

3 KB
Binary file not shown.
2.74 KB
Binary file not shown.

STG_A18/bin/jp/tnw/A18/GameMain.class

4.54 KB
Binary file not shown.

STG_A18/bin/jp/tnw/A18/Image/Item.png

2.52 KB
Loading
263 KB
Loading
227 KB
Loading
190 KB
Loading
253 KB
Loading

STG_A18/bin/jp/tnw/A18/Image/bomb.png

25.6 KB
Loading

STG_A18/bin/jp/tnw/A18/Image/dmg.png

294 Bytes
Loading
213 KB
Loading
35.3 KB
Loading
11.5 KB
Loading

STG_A18/bin/jp/tnw/A18/Image/tama.png

5.3 KB
Loading
4.37 KB
Loading

STG_A18/bin/jp/tnw/A18/Image/zako.png

64.4 KB
Loading

STG_A18/bin/jp/tnw/A18/Item.class

3.33 KB
Binary file not shown.

STG_A18/bin/jp/tnw/A18/Player.class

1.41 KB
Binary file not shown.
3.72 KB
Binary file not shown.

STG_A18/bin/jp/tnw/A18/UnitBase.class

4.47 KB
Binary file not shown.
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package jp.tnw.A18;
2+
3+
import java.awt.Graphics;
4+
import java.awt.image.BufferedImage;
5+
import java.io.IOException;
6+
7+
import javax.imageio.ImageIO;
8+
import javax.swing.JFrame;
9+
10+
public class Background {
11+
12+
BufferedImage Image;
13+
double dblOffsetX;
14+
double dblOffsetY;
15+
int intFlag;
16+
17+
Background() {
18+
19+
}
20+
21+
public void loadimage() {
22+
23+
try {
24+
25+
Image = ImageIO.read(getClass().getResource("Image/bg_04.png"));
26+
27+
} catch (IOException e) {
28+
29+
e.printStackTrace();
30+
31+
}
32+
33+
}
34+
35+
public void drawimage(Graphics Graphic, JFrame Window) {
36+
37+
Graphic.drawImage(Image, 0, 0, 800, 600, 0, 0, 800, 600, Window);
38+
39+
}
40+
41+
public void update() {
42+
43+
}
44+
45+
}

STG_A18/src/jp/tnw/A18/Bomb.java

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
package jp.tnw.A18;
2+
3+
import java.awt.Graphics;
4+
import java.awt.image.BufferedImage;
5+
import java.io.IOException;
6+
7+
import javax.imageio.ImageIO;
8+
import javax.swing.JFrame;
9+
10+
//--------------------
11+
//爆発関連
12+
//--------------------
13+
public class Bomb {
14+
final int WX = 960;// 画面サイズの定義
15+
final int WY = 540;
16+
17+
BufferedImage tk0PNG;// 背景の読み込むメモリ宣言
18+
final double FrameTime = 0.0166667;// 1/60秒
19+
final int max = 30;// 最大数
20+
21+
int flag[] = new int[max];// 0:出現していない
22+
double a_wait[] = new double[max];// アニメwait time
23+
double a_wait_cp[] = new double[max];// アニメwait time copy
24+
25+
int no[] = new int[max];// アニメナンバー
26+
int nox1[] = new int[max];// リクエストナンバー
27+
int nox2[] = new int[max];// アニメサイズx
28+
int noy[] = new int[max];// アニメサイズy
29+
int nom[] = new int[max];// アニメサイズmax
30+
31+
double zx[] = new double[max];// 表示座標 x
32+
double zy[] = new double[max];// 表示座標 y
33+
double timer;// リクエストタイマー
34+
35+
// ----------------
36+
// コンストラクタ
37+
// ----------------
38+
public Bomb() {
39+
40+
// Load();
41+
for (int cnt = 0; cnt < max; cnt++) {
42+
flag[cnt] = 0;
43+
}
44+
45+
}
46+
47+
// ---------------------------
48+
// リクエスト関数
49+
// entry;座標x,y 爆発ナンバー,
50+
// ---------------------------
51+
public void bomb_req(double xx, double yy, int b_no) {
52+
53+
double ani_wait[] = { 0.02, 0.02, 0.02, 0.02, 0.02, 0.01, 0.01, 0.01, 0.01 };// wait
54+
int ani_size[] = { 48, 48, 32, 32, 32, 32, 16, 16, 16 };// size
55+
int ani_pt[] = { 10, 10, 10, 10, 5, 5, 5, 5, 4 };// パターン数
56+
int ani_xx[] = { 0, 16 * 3, 16 * 6, 16 * 8, 16 * 10, 16 * 12, 16 * 14, 16 * 15, 16 * 16 };// 先頭
57+
58+
for (int cnt = 0; cnt < max; cnt++) {
59+
if (flag[cnt] == 0) {
60+
61+
flag[cnt] = 1;//
62+
no[cnt] = 0;
63+
64+
a_wait[cnt] = ani_wait[b_no];// timr
65+
a_wait_cp[cnt] = ani_wait[b_no];// time copy
66+
nox1[cnt] = ani_xx[b_no];// ヨコ先頭
67+
nox2[cnt] = ani_size[b_no];// 幅
68+
noy[cnt] = ani_size[b_no];// 幅
69+
nom[cnt] = ani_pt[b_no];// max
70+
71+
zx[cnt] = xx - ani_size[b_no] / 2;// 表示座標 x
72+
zy[cnt] = yy - ani_size[b_no] / 2;// 表示座標 y
73+
74+
break;
75+
} // if end
76+
} // for end
77+
78+
}
79+
80+
// ---------------------------
81+
// 処理
82+
// ---------------------------
83+
public void UpDate() {
84+
85+
for (int cnt = 0; cnt < max; cnt++) {
86+
if (flag[cnt] != 0) {
87+
88+
a_wait[cnt] -= FrameTime;
89+
if (a_wait[cnt] < 0) {
90+
a_wait[cnt] = a_wait_cp[cnt];// timer reset
91+
92+
no[cnt]++;
93+
if (no[cnt] > nom[cnt])
94+
flag[cnt] = 0;// 爆発end
95+
}
96+
97+
} // flag end
98+
} // for end
99+
100+
}
101+
102+
// ---------------
103+
// ○敵読み込み
104+
// ----------------
105+
public void Load() {
106+
try {
107+
tk0PNG = ImageIO.read(getClass().getResource("Image/bomb.png"));
108+
} catch (IOException e) {
109+
e.printStackTrace();
110+
}
111+
112+
}// Load end
113+
114+
// -----------------------
115+
// 表示関数
116+
// -----------------------
117+
public void Disp(Graphics g, JFrame w) {
118+
119+
for (int cnt = 0; cnt < max; cnt++) {
120+
121+
if (flag[cnt] != 0)
122+
g.drawImage(tk0PNG, (int) zx[cnt], (int) zy[cnt], (int) zx[cnt] + nox2[cnt], (int) zy[cnt] + noy[cnt],
123+
124+
nox1[cnt], noy[cnt] * no[cnt],
125+
126+
nox1[cnt] + nox2[cnt], noy[cnt] * no[cnt] + noy[cnt],
127+
128+
w);
129+
130+
}
131+
132+
}
133+
134+
}

STG_A18/src/jp/tnw/A18/Bullet.java

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
package jp.tnw.A18;
2+
3+
import java.awt.Graphics2D;
4+
import java.io.IOException;
5+
6+
import javax.imageio.ImageIO;
7+
import javax.swing.JFrame;
8+
9+
public class Bullet extends UnitBase {
10+
11+
int UNIT_MAX = 5000;
12+
Player player;
13+
14+
Item item;
15+
16+
int score;
17+
static int jikiPower = 0;
18+
19+
public void loadImage() {
20+
21+
try {
22+
23+
Image = ImageIO.read(getClass().getResource("Image/tama.png"));
24+
25+
} catch (IOException e) {
26+
27+
e.printStackTrace();
28+
29+
}
30+
}
31+
32+
final void drawText(Graphics2D Graphic){
33+
34+
Graphic.drawString("得点: " + String.valueOf(score), 30, 30);
35+
}
36+
37+
public void drawImage(Graphics2D Graphic, JFrame Window) {
38+
39+
// 画像を表示する
40+
for (int i = 0; i < UNIT_MAX; i++) {
41+
if (jikiPower > 1 && jikiPower < 4) {
42+
Graphic.drawImage(Image, (int) dblOffsetX[i], (int) dblOffsetY[i], (int) dblOffsetX[i] + 16,
43+
(int) dblOffsetY[i] + 16, 272, 32 - 16, 272 + 16, 32, Window);
44+
} else if (jikiPower >= 4) {
45+
Graphic.drawImage(Image, (int) dblOffsetX[i] - 8, (int) dblOffsetY[i] - 8, (int) dblOffsetX[i] + 24,
46+
(int) dblOffsetY[i] + 24, 0, 16 * 3, 32, 16 * 5, Window);
47+
} else {
48+
Graphic.drawImage(Image, (int) dblOffsetX[i], (int) dblOffsetY[i], (int) dblOffsetX[i] + 16,
49+
(int) dblOffsetY[i] + 16, 272, 32, 272 + 16, 32 + 16, Window);
50+
}
51+
}
52+
53+
54+
}
55+
56+
public void request() {
57+
58+
dblTimerG = dblTimerG - TIME_UNIT;
59+
if (dblTimerG < 0) {
60+
61+
dblTimerG = jikiPower < 4 ? 0.05 : 0.03;
62+
63+
for (int i = 0; i < UNIT_MAX; i++) {
64+
if (intFlag[i] == 0 && jikiPower != 1 && jikiPower != 4 && jikiPower != 5) { // ONLY
65+
// FOR
66+
// WATING
67+
// OBJECT
68+
69+
intOffsetIndex[i] = 1;
70+
dblOffsetX[i] = player.dblOffsetX[0] + 48 - 8;
71+
dblOffsetY[i] = player.dblOffsetY[0] + 28 - 8;
72+
dblSpdX[i] = 0;
73+
dblSpdY[i] = -800;
74+
intFlag[i] = 1;
75+
intObjQty++;
76+
77+
break;
78+
} // if end
79+
80+
} // for end
81+
82+
}
83+
84+
}
85+
86+
public boolean isOutScreen(int i) {
87+
88+
boolean result;
89+
if (dblOffsetX[i] < -800 || dblOffsetX[i] > 1600 || dblOffsetY[i] < -200 || dblOffsetY[i] > 800) {
90+
result = true;
91+
} else {
92+
result = false;
93+
}
94+
return result;
95+
96+
}
97+
98+
public void update(Enemy em,Bomb bomb,Item item) {
99+
100+
request();
101+
102+
for (int i = 0; i < UNIT_MAX; i++) {
103+
104+
dblSpdX[i] = dblSpdX[i] + TIME_UNIT * dblAccSpdX[i];
105+
dblSpdY[i] = dblSpdY[i] + TIME_UNIT * dblAccSpdY[i];
106+
107+
dblOffsetX[i] = dblOffsetX[i] + TIME_UNIT * dblSpdX[i];
108+
dblOffsetY[i] = dblOffsetY[i] + TIME_UNIT * dblSpdY[i];
109+
110+
if (isOutScreen(i) && intFlag[i] >= 1) {
111+
dblOffsetX[i] = 5000;
112+
dblOffsetY[i] = 5000;
113+
dblSpdX[i] = 0;
114+
dblSpdY[i] = 0;
115+
intFlag[i] = 0;
116+
intObjQty--;
117+
}
118+
119+
for (int j = 0; j < 60; j++) {
120+
if (isRoundHit(dblOffsetX[i] + 12, dblOffsetY[i] + 12, em.dblOffsetX[j] + 24, em.dblOffsetY[j] + 24, 12, 12)) {
121+
bomb.bomb_req(em.dblOffsetX[j] + 24, em.dblOffsetY[j] + 24, 0);
122+
if (j % 47 == 0) {
123+
124+
item.request(em.dblOffsetX[j] + 24, em.dblOffsetY[j] + 24, 1);
125+
}
126+
em.dblOffsetX[j] += 5000;
127+
em.dblOffsetY[j] += 5000;
128+
// em.dblSpdX[i] = 0;
129+
// em.dblSpdY[i] = 0;
130+
131+
132+
dblOffsetX[i] = 5000;
133+
dblOffsetY[i] = 5000;
134+
dblSpdX[i] = 0;
135+
dblSpdY[i] = 0;
136+
intFlag[i] = 0;
137+
intObjQty--;
138+
139+
}
140+
}
141+
}
142+
143+
}
144+
145+
}

0 commit comments

Comments
 (0)