質問編集履歴
3
編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -165,3 +165,67 @@
|
|
165
165
|
|
166
166
|
|
167
167
|
のプログラムは何がどう違ってくるのでしょうか。
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
解きながら学ぶC言語で基礎問題を解いてみたのですが、どうしても以下のことがわかりません。
|
174
|
+
|
175
|
+
```ここに言語を入力
|
176
|
+
|
177
|
+
if (Key[KEY_INPUT_R] == 1 && playerY == enemyY) {
|
178
|
+
|
179
|
+
lock = 1;
|
180
|
+
|
181
|
+
lockonMove = 1;
|
182
|
+
|
183
|
+
//この時点でRを押して、playerY == enemyYと条件が揃っているので真となり、
|
184
|
+
|
185
|
+
//lockonMove = 1より、++lockonMoveとなると思ったのですが。このプログラムではlockonMoveは2にしかならないということでしょうか。
|
186
|
+
|
187
|
+
if (lockonMove > 0) {
|
188
|
+
|
189
|
+
++lockonMove;//ここではlockonMoveは2にしかならないということでしょうか。だとしたら、なぜもう一つのプログラムはループされて+1ずつされるのでしょうか。
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
if (lockonMove == 10) {
|
194
|
+
|
195
|
+
lockImge = lockonHandle[0];
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
} else if (lockonMove == 20) {
|
200
|
+
|
201
|
+
lockImge = lockonHandle[1];
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
} else if (lockonMove == 30) {
|
206
|
+
|
207
|
+
lockImge = lockonHandle[2];
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
} else if (lockonMove == 40) {
|
212
|
+
|
213
|
+
lockImge = lockonHandle[1];
|
214
|
+
|
215
|
+
lockonMove = 1;
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
if (playerY != enemyY) {
|
222
|
+
|
223
|
+
lock = 0;
|
224
|
+
|
225
|
+
lockonMove = 0;
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
}
|
230
|
+
|
231
|
+
```
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
}
|
16
16
|
|
17
|
-
|
17
|
+
if (lockonMove > 0)
|
18
18
|
|
19
19
|
{
|
20
20
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
}
|
24
24
|
|
25
|
-
|
25
|
+
if (lockonMove == 10)
|
26
26
|
|
27
27
|
{
|
28
28
|
|
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
}
|
34
34
|
|
35
|
-
|
35
|
+
else if (lockonMove == 20)
|
36
36
|
|
37
37
|
{
|
38
38
|
|
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
}
|
44
44
|
|
45
|
-
|
45
|
+
else if (lockonMove == 30)
|
46
46
|
|
47
47
|
{
|
48
48
|
|
@@ -54,7 +54,7 @@
|
|
54
54
|
|
55
55
|
}
|
56
56
|
|
57
|
-
|
57
|
+
else if (lockonMove == 40)
|
58
58
|
|
59
59
|
{
|
60
60
|
|
@@ -66,7 +66,7 @@
|
|
66
66
|
|
67
67
|
|
68
68
|
|
69
|
-
|
69
|
+
if (playerY != enemyY)
|
70
70
|
|
71
71
|
{
|
72
72
|
|
@@ -104,7 +104,7 @@
|
|
104
104
|
|
105
105
|
}
|
106
106
|
|
107
|
-
|
107
|
+
if (lockonMove == 10)
|
108
108
|
|
109
109
|
{
|
110
110
|
|
@@ -114,7 +114,7 @@
|
|
114
114
|
|
115
115
|
}
|
116
116
|
|
117
|
-
|
117
|
+
else if (lockonMove == 20)
|
118
118
|
|
119
119
|
{
|
120
120
|
|
@@ -124,7 +124,7 @@
|
|
124
124
|
|
125
125
|
}
|
126
126
|
|
127
|
-
|
127
|
+
else if (lockonMove == 30)
|
128
128
|
|
129
129
|
{
|
130
130
|
|
@@ -136,7 +136,7 @@
|
|
136
136
|
|
137
137
|
}
|
138
138
|
|
139
|
-
|
139
|
+
else if (lockonMove == 40)
|
140
140
|
|
141
141
|
{
|
142
142
|
|
@@ -148,7 +148,7 @@
|
|
148
148
|
|
149
149
|
|
150
150
|
|
151
|
-
|
151
|
+
if (playerY != enemyY) {
|
152
152
|
|
153
153
|
lock = 0;
|
154
154
|
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
```ここに言語を入力
|
4
4
|
|
5
|
-
if (Key[KEY_INPUT_R] == 1 && playerY == enemyY)
|
5
|
+
if (Key[KEY_INPUT_R] == 1 && playerY == enemyY)
|
6
|
+
|
7
|
+
{
|
6
8
|
|
7
9
|
lock = 1;
|
8
10
|
|
@@ -12,13 +14,17 @@
|
|
12
14
|
|
13
15
|
}
|
14
16
|
|
15
|
-
if (lockonMove > 0)
|
17
|
+
if (lockonMove > 0)
|
18
|
+
|
19
|
+
{
|
16
20
|
|
17
21
|
++lockonMove;
|
18
22
|
|
19
23
|
}
|
20
24
|
|
21
|
-
if (lockonMove == 10)
|
25
|
+
if (lockonMove == 10)
|
26
|
+
|
27
|
+
{
|
22
28
|
|
23
29
|
lockImge = lockonHandle[0];
|
24
30
|
|
@@ -26,7 +32,9 @@
|
|
26
32
|
|
27
33
|
}
|
28
34
|
|
29
|
-
else if (lockonMove == 20)
|
35
|
+
else if (lockonMove == 20)
|
36
|
+
|
37
|
+
{
|
30
38
|
|
31
39
|
lockImge = lockonHandle[1];
|
32
40
|
|
@@ -34,7 +42,9 @@
|
|
34
42
|
|
35
43
|
}
|
36
44
|
|
37
|
-
else if (lockonMove == 30)
|
45
|
+
else if (lockonMove == 30)
|
46
|
+
|
47
|
+
{
|
38
48
|
|
39
49
|
lockImge = lockonHandle[2];
|
40
50
|
|
@@ -44,7 +54,9 @@
|
|
44
54
|
|
45
55
|
}
|
46
56
|
|
47
|
-
else if (lockonMove == 40)
|
57
|
+
else if (lockonMove == 40)
|
58
|
+
|
59
|
+
{
|
48
60
|
|
49
61
|
lockImge = lockonHandle[1];
|
50
62
|
|
@@ -54,7 +66,9 @@
|
|
54
66
|
|
55
67
|
|
56
68
|
|
57
|
-
if (playerY != enemyY)
|
69
|
+
if (playerY != enemyY)
|
70
|
+
|
71
|
+
{
|
58
72
|
|
59
73
|
lock = 0;
|
60
74
|
|
@@ -72,7 +86,9 @@
|
|
72
86
|
|
73
87
|
```ここに言語を入力
|
74
88
|
|
75
|
-
if (Key[KEY_INPUT_R] == 1 && playerY == enemyY)
|
89
|
+
if (Key[KEY_INPUT_R] == 1 && playerY == enemyY)
|
90
|
+
|
91
|
+
{
|
76
92
|
|
77
93
|
lock = 1;
|
78
94
|
|
@@ -80,13 +96,17 @@
|
|
80
96
|
|
81
97
|
|
82
98
|
|
83
|
-
if (lockonMove > 0)
|
99
|
+
if (lockonMove > 0)
|
100
|
+
|
101
|
+
{
|
84
102
|
|
85
103
|
++lockonMove;
|
86
104
|
|
87
105
|
}
|
88
106
|
|
89
|
-
if (lockonMove == 10)
|
107
|
+
if (lockonMove == 10)
|
108
|
+
|
109
|
+
{
|
90
110
|
|
91
111
|
lockImge = lockonHandle[0];
|
92
112
|
|
@@ -94,7 +114,9 @@
|
|
94
114
|
|
95
115
|
}
|
96
116
|
|
97
|
-
else if (lockonMove == 20)
|
117
|
+
else if (lockonMove == 20)
|
118
|
+
|
119
|
+
{
|
98
120
|
|
99
121
|
lockImge = lockonHandle[1];
|
100
122
|
|
@@ -102,7 +124,9 @@
|
|
102
124
|
|
103
125
|
}
|
104
126
|
|
105
|
-
else if (lockonMove == 30)
|
127
|
+
else if (lockonMove == 30)
|
128
|
+
|
129
|
+
{
|
106
130
|
|
107
131
|
lockImge = lockonHandle[2];
|
108
132
|
|
@@ -112,7 +136,9 @@
|
|
112
136
|
|
113
137
|
}
|
114
138
|
|
115
|
-
else if (lockonMove == 40)
|
139
|
+
else if (lockonMove == 40)
|
140
|
+
|
141
|
+
{
|
116
142
|
|
117
143
|
lockImge = lockonHandle[1];
|
118
144
|
|