回答編集履歴
1
Wite a program.
test
CHANGED
@@ -8,3 +8,70 @@
|
|
8
8
|
一般論として、自キャラも、敵キャラも、弾も、バラバラのファイルで持つのではなく、全部くっつけて一枚絵にしたものから、切り分けて書き込みます。Windows の場合は、数字や文字は、Windows API で描いてもいいでしょうが、移植を前提とするなら、一枚絵に加えましょう。
|
9
9
|
こういう事は、現在の ChatGPT 等の AI では、教えてくれないようですね。
|
10
10
|
」
|
11
|
+
追記: 2023(05)-06-08
|
12
|
+
[香車]東上☆あらし☆海美「
|
13
|
+
```C+ +
|
14
|
+
#include <vector>
|
15
|
+
class TObj {
|
16
|
+
public:
|
17
|
+
virtual void draw() {}
|
18
|
+
};
|
19
|
+
class TPlayerBase {
|
20
|
+
public:
|
21
|
+
void draw(const int t) {}
|
22
|
+
};
|
23
|
+
class TPlayerUp : public TPlayerBase {
|
24
|
+
public:
|
25
|
+
void draw(const int t) { /* DrawSplight();*/ }
|
26
|
+
};
|
27
|
+
class TPlayerRight : public TPlayerBase {
|
28
|
+
public:
|
29
|
+
void draw(const int t) { /* DrawSplight();*/ }
|
30
|
+
};
|
31
|
+
class TPlayerDown : public TPlayerBase {
|
32
|
+
public:
|
33
|
+
void draw(const int t) { /* DrawSplight();*/ }
|
34
|
+
};
|
35
|
+
class TPlayerLeft : public TPlayerBase {
|
36
|
+
public:
|
37
|
+
void draw(const int t) { /* DrawSplight();*/ }
|
38
|
+
};
|
39
|
+
class TPlayer : public TObj {
|
40
|
+
TPlayerBase* player[4];
|
41
|
+
int vec, t;
|
42
|
+
public:
|
43
|
+
void draw() {
|
44
|
+
player[ vec ]->draw(t);
|
45
|
+
}
|
46
|
+
TPlayer(): vec( 0 ), t( 0 ) {
|
47
|
+
player[0] = new TPlayerUp();
|
48
|
+
player[1] = new TPlayerRight();
|
49
|
+
player[2] = new TPlayerDown();
|
50
|
+
player[3] = new TPlayerLeft();
|
51
|
+
}
|
52
|
+
};
|
53
|
+
class TEnemy : public TObj {
|
54
|
+
public:
|
55
|
+
void draw() { /* You write. */ }
|
56
|
+
};
|
57
|
+
int
|
58
|
+
main() try
|
59
|
+
{
|
60
|
+
std::vector<TObj*> objs;
|
61
|
+
objs.push_back(new TPlayer());
|
62
|
+
objs.push_back(new TEnemy());
|
63
|
+
//
|
64
|
+
while ( true /* You write */) {
|
65
|
+
for (auto i: objs) {
|
66
|
+
i->draw();
|
67
|
+
}
|
68
|
+
}
|
69
|
+
return EXIT_SUCCESS;
|
70
|
+
}
|
71
|
+
catch (...)
|
72
|
+
{
|
73
|
+
return EXIT_FAILURE;
|
74
|
+
}
|
75
|
+
```
|
76
|
+
このままで Windows で走るわけでは、ありません。
|
77
|
+
」
|