質問編集履歴
2
タグを編集
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
1
提示コードを修正して画像も追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
提示画像の一番上のキャラクターが自分のキャラクターでそれを右に動かしてその後上に動かした時にちゃんと後ろを追いかけてくれる処理を作りたいです。
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
![イメージ説明](325417c0229c77b1a11243216c4eed84.png)
|
12
|
+
|
13
|
+
|
14
|
+
|
5
15
|
|
6
16
|
|
7
17
|
|
@@ -18,9 +28,9 @@
|
|
18
28
|
|
19
29
|
|
20
30
|
|
21
|
-
const char* filename = "Log.txt";
|
31
|
+
static const char* filename = "Log.txt";
|
22
|
-
|
32
|
+
|
23
|
-
std::ofstream ofs(filename);
|
33
|
+
static std::ofstream ofs(filename);
|
24
34
|
|
25
35
|
|
26
36
|
|
@@ -166,7 +176,7 @@
|
|
166
176
|
|
167
177
|
|
168
178
|
|
169
|
-
|
179
|
+
*player->PrevPos = *player->position;
|
170
180
|
|
171
181
|
player->Move(speed);
|
172
182
|
|
@@ -182,27 +192,45 @@
|
|
182
192
|
|
183
193
|
{
|
184
194
|
|
195
|
+
|
196
|
+
|
197
|
+
// member_a->position->x = p.x - mapCELL;
|
198
|
+
|
199
|
+
// member_a->position->y = p.y - mapCELL;
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
185
|
-
i
|
205
|
+
/*Right move*/
|
206
|
+
|
186
|
-
|
207
|
+
if(player->getDirection().x > 0 && player->getDirection().y == 0)
|
208
|
+
|
187
|
-
{
|
209
|
+
{
|
188
|
-
|
210
|
+
|
211
|
+
|
212
|
+
|
189
|
-
|
213
|
+
member_a->position->x = player->PrevPos->x - mapCELL;
|
190
|
-
|
191
|
-
|
192
|
-
|
214
|
+
|
193
|
-
|
215
|
+
member_a->position->y = player->PrevPos->y;
|
216
|
+
|
194
|
-
|
217
|
+
}else if (player->getDirection().x < 0 && player->getDirection().y == 0)
|
218
|
+
|
195
|
-
|
219
|
+
{
|
220
|
+
|
221
|
+
|
222
|
+
|
196
|
-
|
223
|
+
member_a->position->x = player->PrevPos->x + mapCELL;
|
224
|
+
|
197
|
-
|
225
|
+
member_a->position->y = player->PrevPos->y;
|
198
|
-
|
199
|
-
|
200
|
-
|
226
|
+
|
201
|
-
|
227
|
+
}
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
206
234
|
|
207
235
|
|
208
236
|
|
@@ -256,14 +284,14 @@
|
|
256
284
|
|
257
285
|
map->Update();
|
258
286
|
|
287
|
+
member_a->Update();
|
288
|
+
|
289
|
+
member_b->Update();
|
290
|
+
|
291
|
+
member_c->Update();
|
292
|
+
|
259
293
|
player->Update();
|
260
294
|
|
261
|
-
member_a->Update();
|
262
|
-
|
263
|
-
member_b->Update();
|
264
|
-
|
265
|
-
member_c->Update();
|
266
|
-
|
267
295
|
|
268
296
|
|
269
297
|
}
|
@@ -280,13 +308,19 @@
|
|
280
308
|
|
281
309
|
map->Draw_Update();
|
282
310
|
|
311
|
+
member_a->Draw_Update();
|
312
|
+
|
313
|
+
member_b->Draw_Update();
|
314
|
+
|
315
|
+
member_c->Draw_Update();
|
316
|
+
|
283
317
|
player->Draw_Update();
|
284
318
|
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
285
|
-
me
|
323
|
+
DrawFormatString(0, 0, GetColor(0, 0, 0), "player: %.2f , %.2f", player->position->x, player->position->y);
|
286
|
-
|
287
|
-
member_b->Draw_Update();
|
288
|
-
|
289
|
-
member_c->Draw_Update();
|
290
324
|
|
291
325
|
|
292
326
|
|