質問編集履歴

1

付け加えました

2019/03/22 05:25

投稿

Ak11
Ak11

スコア15

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,207 @@
6
6
 
7
7
 
8
8
 
9
-
9
+ ```html
10
+
11
+ <!DOCTYPE HTML>
12
+
13
+
14
+
15
+ <html lang="jp" dir="ltr">
16
+
17
+ <head>
18
+
19
+
20
+
21
+ <meta charset="utf-8">
22
+
23
+ <title>test</title>
24
+
25
+ <link rel="stylesheet" href="style.css">
26
+
27
+ <script src="http://code.jquery.com/jquery-3.3.1.js"></script>
28
+
29
+ </head>
30
+
31
+ <body>
32
+
33
+ <div id = "soft"></div>
34
+
35
+ <div class="title">
36
+
37
+ TEST GAME
38
+
39
+ </div>
40
+
41
+
42
+
43
+ <div id="player"></div>
44
+
45
+ <div>
46
+
47
+ <ul class="menu">
48
+
49
+ <li id = "Attack" class="Attack">攻撃</li>
50
+
51
+ <li id = "Magic" class="Magic">魔法</li>
52
+
53
+ </ul>
54
+
55
+ <ul class="magicMenu">
56
+
57
+ <li id ="Fspell">炎魔法</li>
58
+
59
+ <li id ="Ispell">氷魔法</li>
60
+
61
+ <li id ="Lspell">雷魔法</li>
62
+
63
+ <li id ="Hspell">回復魔法</li>
64
+
65
+ <li id ="return">戻る</li>
66
+
67
+
68
+
69
+ </ul>
70
+
71
+
72
+
73
+ <ul class="Pstatus">
74
+
75
+ <li class="PHitPoint">Pl.HP</li>
76
+
77
+ <li class="PMagicPoint">Pl.MP</li>
78
+
79
+ </ul>
80
+
81
+ </div>
82
+
83
+
84
+
85
+ <div id="enemy">
86
+
87
+ <ul class="Estatus">
88
+
89
+ <li class="EHitPoint">En.HP</li>
90
+
91
+ <li class="EMagicPoint">En.MP</li>
92
+
93
+ </ul>
94
+
95
+ </div>
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ <script type="text/javascript">
104
+
105
+
106
+
107
+ //画面処理
108
+
109
+ var soft1 = document.getElementById("soft");
110
+
111
+ var input1 = document.createElement("input");
112
+
113
+ var div1 = document.createElement("div");
114
+
115
+
116
+
117
+ input1.setAttribute("value" , "START");
118
+
119
+ input1.setAttribute("id", "input");
120
+
121
+ input1.setAttribute("type", "button");
122
+
123
+
124
+
125
+
126
+
127
+ div1.appendChild(input1);
128
+
129
+ soft1.appendChild(div1);
130
+
131
+
132
+
133
+ //ゲーム処理
134
+
135
+
136
+
137
+ var Attack = document.getElementById("Attack");
138
+
139
+ var Magic = document.getElementById("Magic");
140
+
141
+
142
+
143
+ class Player {
144
+
145
+ constructor(HP,MP){
146
+
147
+ this.HP =HP;
148
+
149
+ this.MP =MP;
150
+
151
+ }
152
+
153
+ }
154
+
155
+ class Enemy {
156
+
157
+ constructor(HP,MP){
158
+
159
+ this.HP =HP;
160
+
161
+ this.MP =MP;
162
+
163
+ }
164
+
165
+ }
166
+
167
+
168
+
169
+ const Pl = new Player(100,50);
170
+
171
+ const En = new Enemy(200,50);
172
+
173
+
174
+
175
+ function statusShow() {
176
+
177
+
178
+
179
+ $(".PHitPoint").html("HP:"+Pl.HP);
180
+
181
+ $(".PMagicPoint").html("MP:"+Pl.MP);
182
+
183
+
184
+
185
+ $(".EHitPoint").html("HP:"+En.HP);
186
+
187
+ $(".EMagicPoint").html("MP:"+En.MP);
188
+
189
+ }
190
+
191
+
192
+
193
+ statusShow () ;
194
+
195
+
196
+
197
+ </script>
198
+
199
+ <script src="script.js"></script>
200
+
201
+
202
+
203
+ </body>
204
+
205
+ </html>
206
+
207
+
208
+
209
+ ```
10
210
 
11
211
 
12
212
 
@@ -71,3 +271,167 @@
71
271
  });
72
272
 
73
273
  ```
274
+
275
+ ```css
276
+
277
+ #input {
278
+
279
+ position:absolute;
280
+
281
+ top:0px;
282
+
283
+ bottom:0px;
284
+
285
+ left:0px;
286
+
287
+ right:0px;
288
+
289
+ margin: auto;
290
+
291
+ width:80px;
292
+
293
+ height:30px;
294
+
295
+ }
296
+
297
+
298
+
299
+ .title {
300
+
301
+ width:300px;
302
+
303
+ height:100px;
304
+
305
+ font-size:50px;
306
+
307
+ position:absolute;
308
+
309
+ top:0px;
310
+
311
+ bottom:150px;
312
+
313
+ left:0px;
314
+
315
+ right:0px;
316
+
317
+ margin: auto;
318
+
319
+ }
320
+
321
+
322
+
323
+ #player {
324
+
325
+ //display:none;
326
+
327
+ width:100px;
328
+
329
+ height:100px;
330
+
331
+ background-color:black;
332
+
333
+ position:absolute;
334
+
335
+ top:350px;
336
+
337
+ }
338
+
339
+
340
+
341
+ #enemy {
342
+
343
+ //display:none;
344
+
345
+ width:100px;
346
+
347
+ height:100px;
348
+
349
+ background-color:red;
350
+
351
+ position:absolute;
352
+
353
+ top:350px;
354
+
355
+ right:50px;
356
+
357
+ }
358
+
359
+ .menu {
360
+
361
+ //display:none;
362
+
363
+ border: 2px solid black;
364
+
365
+ width:130px;
366
+
367
+ height:100px;
368
+
369
+ position:absolute;
370
+
371
+ top:200px;
372
+
373
+ left:200px;
374
+
375
+ }
376
+
377
+
378
+
379
+ .Pstatus{
380
+
381
+ //display:none;
382
+
383
+ border: 2px solid black;
384
+
385
+ width:130px;
386
+
387
+ height:100px;
388
+
389
+ position:absolute;
390
+
391
+ top:200px;
392
+
393
+ left:10px;
394
+
395
+ }
396
+
397
+ .Estatus{
398
+
399
+ //display:none;
400
+
401
+ border: 2px solid black;
402
+
403
+ width:130px;
404
+
405
+ height:100px;
406
+
407
+ position:absolute;
408
+
409
+ bottom:110px;
410
+
411
+ right:10px;
412
+
413
+ }
414
+
415
+
416
+
417
+ .magicMenu{
418
+
419
+ display:none;
420
+
421
+ border: 2px solid black;
422
+
423
+ background-color: white;
424
+
425
+ width:130px;
426
+
427
+ height:130px;
428
+
429
+ position:absolute;
430
+
431
+ top:200px;
432
+
433
+ left:200px;
434
+
435
+ }
436
+
437
+ ```