質問編集履歴

3

再投稿につき変更

2016/04/29 03:05

投稿

nosonosolife
nosonosolife

スコア42

test CHANGED
@@ -1 +1 @@
1
- jqueryのスロットゲームのリールをぴっり止めたい
1
+ 投稿し直しまし
test CHANGED
@@ -1,229 +1,3 @@
1
- 現在、jqueryでスロットゲーム製作ていす。
1
+ 質問投稿直しした
2
2
 
3
- 今のところリールを動かしてストップボタンで停止する部分は出来たのですが、停止した際にリールの絵柄がピタッと中心に止まるようにするにはどうすればいいでしょうか。
4
-
5
- また、下記のコードの中で直しておいたほうがいい部分があればできる限りご教授いただきたいと思っております。よろしくお願いいたします。
6
-
7
- ```javascript
8
-
9
- $(function() {
10
-
11
- var reelmoveAnime;
12
-
13
- var rundresultAnime
14
-
15
- //配列
16
-
17
- var iconArray = [[4, 5, 1, 3, 4, 6, 1, 3, 2, 6, 4, 3, 5, 6, 2, 5, 6, 4, 3, 0, 6], [6, 4, 1, 3, 6, 5, 4, 5, 6, 4, 2, 3, 6, 0, 4, 3, 6, 1, 4, 2, 5], [5, 3, 1, 4, 6, 3, 4, 0, 6, 3, 5, 6, 2, 3, 4, 6, 5, 0, 3, 4, 6]];
18
-
19
- var reelArray = new Array();
20
-
21
- var reelNum = 3;
22
-
23
- var iconNum = 21;
24
-
25
- var iconWidth = 120;
26
-
27
- var iconHeight = 60;
28
-
29
- var reelMargin = 10;
30
-
31
- var reelBaseX = 18;
32
-
33
- var reelBaseY = 92;
34
-
35
-
36
-
37
- var reelStopArray = [null, null, null];
38
-
39
- var reelStopNum = 0;
40
-
41
-
42
-
43
- var outRateArray = [0, 1, 4, 20, 25];
44
-
45
-
46
-
47
- var reelposY = [0, 0, 0];
48
-
49
- var reelstartAnime;
50
-
51
- var reelmoveAnime;
52
-
53
- var reelHeight = (iconHeight*iconNum); //リールの高さ
54
-
55
-
56
-
57
- //FPS
58
-
59
- var fps = 60;
60
-
61
- var interval = 1/fps*1000;
62
-
63
-
64
-
65
- addSlots();
66
-
67
-
68
-
69
- //BGM
70
-
71
- SlotBGM.play();
72
-
73
-
74
-
75
- $('#startbtn').click(function() {
76
-
77
- $(this).css("pointer-events", "none");
78
-
79
- slotstart();
80
-
81
- });
82
-
83
-
84
-
85
- $('[id^=stopbtn]').each(function(i){
86
-
87
- $(this).click(function() {
88
-
89
- $(this).css("pointer-events", "none");
90
-
91
- slotStop(i);
92
-
93
- });
94
-
95
- });
96
-
97
-
98
-
99
- function slotstart(){
100
-
101
- reelStopArray = [false, false, false];
102
-
103
- reelStopNum = 0;
104
-
105
- var startSpeedcnt = 0;
106
-
107
- reelstartAnime = setInterval(function(){
108
-
109
- if(startSpeedcnt <= 60){
110
-
111
- startSpeedcnt++;
112
-
113
- for (var i = 0; i < reelNum; i++) {
114
-
115
- reelposY[i] += Math.floor(iconHeight/reelHeight * startSpeedcnt);
116
-
117
- $('.wrapper').eq(i).css("top", reelposY[i]+"px");
118
-
119
- slip[i] -= Math.floor(iconHeight/reelHeight * 60);
120
-
121
- if (reelposY[i] >= 0) reelposY[i] = -reelHeight;
122
-
123
- }
124
-
125
- }else{
126
-
127
- clearInterval(reelstartAnime);
128
-
129
- reelmoveAnime = setInterval(slotMove, interval);
130
-
131
- $('[id^=stopbtn]').css("pointer-events", "auto");
132
-
133
- }
134
-
135
- },interval);
136
-
137
- }
138
-
139
-
140
-
141
- function slotStop(i){
142
-
143
- if(reelStopNum <= reelNum){
144
-
145
- reelStopNum++;
146
-
147
- reelStopArray[i] = true;
148
-
149
- }
150
-
151
- if(reelStopArray[reelNum-1]) {
152
-
153
- $('#startbtn').css("pointer-events", "auto");
154
-
155
- clearInterval(reelmoveAnime);
156
-
157
- }
158
-
159
- SeStopBtn.play();
160
-
161
- }
162
-
163
-
164
-
165
- //リール作成
166
-
167
- function addSlots() {
168
-
169
- reelStopArray[i] = false;
170
-
171
- for (var i = 0; i < reelNum; i++) {
172
-
173
- $('.reel').eq(i).css("left", ((iconWidth + reelMargin) * i)+"px");
174
-
175
- $('.wrapper').eq(i).css("height", reelHeight+"px");
176
-
177
- for (var j = 0; j < 24; j++) {
178
-
179
- if(j < 21){
180
-
181
- $('.wrapper').eq(i).append("<li class='icon icon" + iconArray[i][j] + "'>" + iconArray[i][j] + "</li>");
182
-
183
- }else{
184
-
185
- $('.wrapper').eq(i).append("<li class='icon icon" + iconArray[i][j - 21] + "'>" + iconArray[i][j - 21] + "</li>");
186
-
187
- }
188
-
189
- }
190
-
191
- }
192
-
193
- }
194
-
195
-
196
-
197
- //リール回転
198
-
199
- function slotMove(){
200
-
201
- for (var i = 0; i < reelNum; i++) {
202
-
203
- if (!reelStopArray[i]) {
204
-
205
- reelposY[i] += Math.floor(iconHeight/reelHeight * 60);
206
-
207
- $('.wrapper').eq(i).css("top", reelposY[i]+"px");
208
-
209
- slip[i] -= Math.floor(iconHeight/reelHeight * 60);
210
-
211
- if (reelposY[i] >= 0) reelposY[i] = -reelHeight;
212
-
213
- }else{
214
-
215
- //while((reelposY[i]%iconHeight+slip[i])%iconHeight!=iconHeight/2) {
216
-
217
- // slip[i] += Math.floor(iconHeight/reelHeight * 60);
218
-
219
- //}
220
-
221
- }
222
-
223
- }
224
-
225
- }
226
-
227
- });
228
-
229
- ```
3
+ https://teratail.com/questions/33700

2

タイトル変更

2016/04/29 03:05

投稿

nosonosolife
nosonosolife

スコア42

test CHANGED
@@ -1 +1 @@
1
- jqueryスロットゲーム
1
+ jqueryスロットゲームのリールをぴったり止めたい
test CHANGED
File without changes

1

大幅に変更

2016/04/27 04:55

投稿

nosonosolife
nosonosolife

スコア42

test CHANGED
File without changes
test CHANGED
@@ -1,845 +1,229 @@
1
1
  現在、jqueryでスロットゲームを製作しています。
2
2
 
3
- 今のところリールを動かす仕組み完成したのですが、で途切れたように見えてまいます
4
-
5
- ようなもを制作したいというと、
6
-
7
- ・リールごとに絵柄の順番を変える
8
-
9
- ・違和感なく滑らかに、リールが回転しているように見せる
10
-
11
- ・ストップボタンを押した後、全てのリールを順番にストップさせる
12
-
13
- ・複数の絵柄がそろったら何らかのイベントを起こす
14
-
15
- というものです。
16
-
17
- 上記のいずれかでも構いませんので、できる限りご教授いただきたいと思います。よろしくお願いいたします。
18
-
19
- ```html
20
-
21
- <!DOCTYPE html>
22
-
23
- <html lang="ja">
24
-
25
- <head>
26
-
27
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
28
-
29
- <title>スロット</title>
30
-
31
- <meta content="no" http-equiv="Imagetoolbar">
32
-
33
- <meta content="" name="description">
34
-
35
- <meta content="" name="keywords">
36
-
37
- <meta content="index,nofollow" name="robots">
38
-
39
- <meta content="text/javascript" http-equiv="Content-Script-Type">
40
-
41
- <meta content="text/css" http-equiv="Content-Style-TSype">
42
-
43
- <meta content="IE=Edge" http-equiv="X-UA-Compatible">
44
-
45
- <script src="js_css/jquery.js" type="text/javascript"></script>
46
-
47
- <style type="text/css">
48
-
49
- <!--
50
-
51
- html{
52
-
53
- margin:0px;
54
-
55
- padding:0px;
56
-
57
- min-height:100%;
58
-
59
- position:relative;
60
-
61
- }
62
-
63
-
64
-
65
- body {
66
-
67
- font-family: Meiryo,'Hiragino Kaku Gothic Pro W3','MS Gothic',Osaka,Sans-Serif;
68
-
69
- position: relative;
70
-
71
- width: 100%;
72
-
73
- height: 100%;
74
-
75
- margin: 0 auto;
76
-
77
- padding: 0;
78
-
79
- text-align:center;
80
-
81
- background-color: #fff;
82
-
83
- }
84
-
85
-
86
-
87
- #slotmachinebox {
88
-
89
- position: absolute;
90
-
91
- top:50%;
92
-
93
- left:50%;
94
-
95
- display: block;
96
-
97
- width: 686px;
98
-
99
- height: 451px;
100
-
101
- margin:0px auto;
102
-
103
- padding: 0;
104
-
105
- background-image: url(slot/img/slotmainbg.png);
106
-
107
- }
108
-
109
-
110
-
111
- #slotmachinebox #reelbox {
112
-
113
- position: absolute;
114
-
115
- top: 58px;
116
-
117
- left: 3px;
118
-
119
- display: block;
120
-
121
- overflow: hidden;
122
-
123
- width: 680px;
124
-
125
- height: 185px;
126
-
127
- margin: 0;
128
-
129
- padding: 0;
130
-
131
- background-image: url(slot/img/slotparts.png);
132
-
133
- background-position: -0 -0;
134
-
135
- }
136
-
137
-
138
-
139
- #slotmachinebox #reelbox #reeledge {
140
-
141
- position: absolute;
142
-
143
- z-index: 2;
144
-
145
- display: block;
146
-
147
- overflow: hidden;
148
-
149
- width: 680px;
150
-
151
- height: 185px;
152
-
153
- margin: 0;
154
-
155
- padding: 0;
156
-
157
- background-image: url(slot/img/slotparts.png);
158
-
159
- background-position: -0 -0;
160
-
161
- }
162
-
163
-
164
-
165
- #slotmachinebox #reelbox #reel {
166
-
167
- position: absolute;
168
-
169
- z-index: 1;
170
-
171
- display: block;
172
-
173
- overflow: hidden;
174
-
175
- width: 120px;
176
-
177
- height: 360px;
178
-
179
- margin: 0;
180
-
181
- padding: 0;
182
-
183
- }
184
-
185
-
186
-
187
- #slotmachinebox #reelbox .reel0{
188
-
189
- top: -85px;
190
-
191
- left: 16px;
192
-
193
- }
194
-
195
-
196
-
197
- #slotmachinebox #reelbox .reel1{
198
-
199
- top: -85px;
200
-
201
- left: 148px;
202
-
203
- }
204
-
205
-
206
-
207
- #slotmachinebox #reelbox .reel2{
208
-
209
- top: -85px;
210
-
211
- left: 280px;
212
-
213
- }
214
-
215
-
216
-
217
- #slotmachinebox #reelbox .reel3{
218
-
219
- top: -85px;
220
-
221
- left: 412px;
222
-
223
- }
224
-
225
-
226
-
227
- #slotmachinebox #reelbox .reel4{
228
-
229
- top: -85px;
230
-
231
- left: 544px;
232
-
233
- }
234
-
235
- #slotmachinebox #reelbox .wrapper{
236
-
237
- position: absolute;
238
-
239
- top: 0px;
240
-
241
- left: 0px;
242
-
243
- width: 120px;
244
-
245
- height: 1680px;
246
-
247
- margin: 0;
248
-
249
- padding: 0;
250
-
251
- }
252
-
253
- #slotmachinebox #reelbox .wrapper .icon0,
254
-
255
- #slotmachinebox #reelbox .wrapper .icon1,
256
-
257
- #slotmachinebox #reelbox .wrapper .icon2,
258
-
259
- #slotmachinebox #reelbox .wrapper .icon3,
260
-
261
- #slotmachinebox #reelbox .wrapper .icon4,
262
-
263
- #slotmachinebox #reelbox .wrapper .icon5,
264
-
265
- #slotmachinebox #reelbox .wrapper .icon6,
266
-
267
- #slotmachinebox #reelbox .wrapper .icon7,
268
-
269
- #slotmachinebox #reelbox .wrapper .icon8,
270
-
271
- #slotmachinebox #reelbox .wrapper .icon9,
272
-
273
- #slotmachinebox #reelbox .wrapper .icon10,
274
-
275
- #slotmachinebox #reelbox .wrapper .icon11,
276
-
277
- #slotmachinebox #reelbox .wrapper .icon12,
278
-
279
- #slotmachinebox #reelbox .wrapper .icon13,
280
-
281
- #slotmachinebox #reelbox .wrapper .icon14 {
282
-
283
- display: block;
284
-
285
- width: 120px;
286
-
287
- height: 120px;
288
-
289
- background-image: url(slot/img/sloticons.png);
290
-
291
- }
292
-
293
-
294
-
295
- #slotmachinebox #reelbox .wrapper .icon0{
296
-
297
- background-position: 0 0px;
298
-
299
- }
300
-
301
-
302
-
303
- #slotmachinebox #reelbox .wrapper .icon1{
304
-
305
- background-position: 0 -120px;
306
-
307
- }
308
-
309
-
310
-
311
- #slotmachinebox #reelbox .wrapper .icon2{
312
-
313
- background-position: 0 -240px;
314
-
315
- }
316
-
317
-
318
-
319
- #slotmachinebox #reelbox .wrapper .icon3{
320
-
321
- background-position: 0 -360px;
322
-
323
- }
324
-
325
-
326
-
327
- #slotmachinebox #reelbox .wrapper .icon4{
328
-
329
- background-position: 0 -480px;
330
-
331
- }
332
-
333
-
334
-
335
- #slotmachinebox #reelbox .wrapper .icon5{
336
-
337
- background-position: 0 -600px;
338
-
339
- }
340
-
341
-
342
-
343
- #slotmachinebox #reelbox .wrapper .icon6{
344
-
345
- background-position: 0 -720px;
346
-
347
- }
348
-
349
-
350
-
351
- #slotmachinebox #reelbox .wrapper .icon7{
352
-
353
- background-position: 0 -840px;
354
-
355
- }
356
-
357
-
358
-
359
- #slotmachinebox #reelbox .wrapper .icon8{
360
-
361
- background-position: 0 -960px;
362
-
363
- }
364
-
365
-
366
-
367
- #slotmachinebox #reelbox .wrapper .icon9{
368
-
369
- background-position: 0 -1080px;
370
-
371
- }
372
-
373
-
374
-
375
- #slotmachinebox #reelbox .wrapper .icon10{
376
-
377
- background-position: 0 -1200px;
378
-
379
- }
380
-
381
-
382
-
383
- #slotmachinebox #reelbox .wrapper .icon11{
384
-
385
- background-position: 0 -1320px;
386
-
387
- }
388
-
389
-
390
-
391
- #slotmachinebox #reelbox .wrapper .icon12{
392
-
393
- background-position: 0 -1440px;
394
-
395
- }
396
-
397
-
398
-
399
- #slotmachinebox #reelbox .wrapper .icon13{
400
-
401
- background-position: 0 -1560px;
402
-
403
- }
404
-
405
-
406
-
407
- #slotmachinebox #reelbox .wrapper .icon14{
408
-
409
- background-position: 0 -1680px;
410
-
411
- }
412
-
413
-
414
-
415
- #slotmachinebox #stopbtn {
416
-
417
- position: absolute;
418
-
419
- top: 250px;
420
-
421
- left: 10px;
422
-
423
- display: block;
424
-
425
- width: 256px;
426
-
427
- height: 135px;
428
-
429
- margin: 0;
430
-
431
- padding: 0;
432
-
433
- cursor: pointer;
434
-
435
- background-image: url(slot/img/slotparts.png);
436
-
437
- background-position: -0 -185px;
438
-
439
- }
440
-
441
-
442
-
443
- #slotmachinebox #stopbtn:hover {
444
-
445
- background-position: 0 -320px;
446
-
447
- }
448
-
449
-
450
-
451
- #slotmachinebox #stopbtn:active {
452
-
453
- background-position: 0 -455px;
454
-
455
- }
456
-
457
-
458
-
459
- #slotmachinebox #resultbox {
460
-
461
- position: absolute;
462
-
463
- top: 253px;
464
-
465
- left: 265px;
466
-
467
- display: block;
468
-
469
- width: 402px;
470
-
471
- height: 128px;
472
-
473
- margin: 0;
474
-
475
- padding: 0;
476
-
477
- background-image: url(slot/img/slotparts.png);
478
-
479
- background-position: -256px -185px;
480
-
481
- }
482
-
483
-
484
-
485
- #slotmachinebox #resultbox h1 {
486
-
487
- position: absolute;
488
-
489
- top: 46px;
490
-
491
- left: 14px;
492
-
493
- display: block;
494
-
495
- overflow: hidden;
496
-
497
- width: 103px;
498
-
499
- height: 32px;
500
-
501
- margin: 0;
502
-
503
- padding: 0;
504
-
505
- text-indent: -10000px;
506
-
507
- background-image: url(slot/img/slotparts.png);
508
-
509
- background-position: -256px -313px;
510
-
511
- }
512
-
513
-
514
-
515
- #slotmachinebox #resultbox #numbox2 {
516
-
517
- position: absolute;
518
-
519
- top: 16px;
520
-
521
- left: 108px;
522
-
523
- }
524
-
525
-
526
-
527
- #slotmachinebox #resultbox #numbox1 {
528
-
529
- position: absolute;
530
-
531
- top: 16px;
532
-
533
- left: 164px;
534
-
535
- }
536
-
537
-
538
-
539
- #slotmachinebox #resultbox #numbox0 {
540
-
541
- position: absolute;
542
-
543
- top: 16px;
544
-
545
- left: 231px;
546
-
547
- }
548
-
549
-
550
-
551
- #slotmachinebox #resultbox span.num0,
552
-
553
- #slotmachinebox #resultbox span.num1,
554
-
555
- #slotmachinebox #resultbox span.num2,
556
-
557
- #slotmachinebox #resultbox span.num3,
558
-
559
- #slotmachinebox #resultbox span.num4,
560
-
561
- #slotmachinebox #resultbox span.num5,
562
-
563
- #slotmachinebox #resultbox span.num6,
564
-
565
- #slotmachinebox #resultbox span.num7,
566
-
567
- #slotmachinebox #resultbox span.num8,
568
-
569
- #slotmachinebox #resultbox span.num9 {
570
-
571
- display: block;
572
-
573
- float: left;
574
-
575
- overflow: hidden;
576
-
577
- width: 69px;
578
-
579
- height: 95px;
580
-
581
- text-indent: -10000px;
582
-
583
- background-image: url(slot/img/slotnums.png);
584
-
585
- }
586
-
587
-
588
-
589
- #slotmachinebox #resultbox span.num0 {
590
-
591
- background-position: 0 0;
592
-
593
- }
594
-
595
-
596
-
597
- #slotmachinebox #resultbox span.num1 {
598
-
599
- background-position: -69px 0;
600
-
601
- }
602
-
603
-
604
-
605
- #slotmachinebox #resultbox span.num2 {
606
-
607
- background-position: -138px 0;
608
-
609
- }
610
-
611
-
612
-
613
- #slotmachinebox #resultbox span.num3 {
614
-
615
- background-position: -207px 0;
616
-
617
- }
618
-
619
-
620
-
621
- #slotmachinebox #resultbox span.num4 {
622
-
623
- background-position: -276px 0;
624
-
625
- }
626
-
627
-
628
-
629
- #slotmachinebox #resultbox span.num5 {
630
-
631
- background-position: -345px 0;
632
-
633
- }
634
-
635
-
636
-
637
- #slotmachinebox #resultbox span.num6 {
638
-
639
- background-position: -414px 0;
640
-
641
- }
642
-
643
-
644
-
645
- #slotmachinebox #resultbox span.num7 {
646
-
647
- background-position: -483px 0;
648
-
649
- }
650
-
651
-
652
-
653
- #slotmachinebox #resultbox span.num8 {
654
-
655
- background-position: -552px 0;
656
-
657
- }
658
-
659
-
660
-
661
- #slotmachinebox #resultbox span.num9 {
662
-
663
- background-position: -621px 0;
664
-
665
- }
666
-
667
-
668
-
669
- #slotmachinebox #resultbox span.nump {
670
-
671
- position: absolute;
672
-
673
- top: 40px;
674
-
675
- left: 299px;
676
-
677
- width: 76px;
678
-
679
- height: 70px;
680
-
681
- text-indent: -10000px;
682
-
683
- background-image: url(slot/img/slotnums.png);
684
-
685
- background-position: -690px 0;
686
-
687
- }
688
-
689
- -->
690
-
691
- </style>
692
-
693
- <script type="text/javascript">
694
-
695
- <!--
3
+ 今のところリールを動かしてストップボタンで停止る部分出来たのですが、停止した際にリールの絵柄がピタッと心に止まるようにするにはどうすればいいでょうか
4
+
5
+ また、下記コード中で直ておいほうがい部分があればできる限りご教授いただきたい思っております。よろしくお願いたします。
6
+
7
+ ```javascript
696
8
 
697
9
  $(function() {
698
10
 
699
- //slotmachineboxを画面中央に
700
-
701
- var windowW = $(window).innerWidth(); //ブラウザの幅を取得
702
-
703
- var windowH = $(window).innerHeight(); //ブラウザの高さを取得
704
-
705
- var divW = $("#slotmachinebox").innerWidth(); //divの幅を取得
706
-
707
- var divH = $("#slotmachinebox").innerHeight(); //divの高さを取得
708
-
709
- //bodyにブラウザの幅と高さを代入
710
-
711
- $("body").css("height", windowW + "px");
712
-
713
- $("body").css("height", windowH + "px");
714
-
715
- //divの半分の値のネガティブマージンを代入
716
-
717
- $("#slotmachinebox").css("margin-left", "-" + divW / 2 + "px");
718
-
719
- $("#slotmachinebox").css("margin-top", "-" + divH / 2 + "px");
720
-
721
-
11
+ var reelmoveAnime;
12
+
13
+ var rundresultAnime
14
+
15
+ //配列
16
+
17
+ var iconArray = [[4, 5, 1, 3, 4, 6, 1, 3, 2, 6, 4, 3, 5, 6, 2, 5, 6, 4, 3, 0, 6], [6, 4, 1, 3, 6, 5, 4, 5, 6, 4, 2, 3, 6, 0, 4, 3, 6, 1, 4, 2, 5], [5, 3, 1, 4, 6, 3, 4, 0, 6, 3, 5, 6, 2, 3, 4, 6, 5, 0, 3, 4, 6]];
18
+
19
+ var reelArray = new Array();
20
+
21
+ var reelNum = 3;
22
+
23
+ var iconNum = 21;
24
+
25
+ var iconWidth = 120;
26
+
27
+ var iconHeight = 60;
28
+
29
+ var reelMargin = 10;
30
+
31
+ var reelBaseX = 18;
32
+
33
+ var reelBaseY = 92;
34
+
35
+
36
+
37
+ var reelStopArray = [null, null, null];
38
+
39
+ var reelStopNum = 0;
40
+
41
+
42
+
43
+ var outRateArray = [0, 1, 4, 20, 25];
44
+
45
+
46
+
47
+ var reelposY = [0, 0, 0];
48
+
49
+ var reelstartAnime;
50
+
51
+ var reelmoveAnime;
52
+
53
+ var reelHeight = (iconHeight*iconNum); //リールの高さ
54
+
55
+
722
56
 
723
57
  //FPS
724
58
 
59
+ var fps = 60;
60
+
725
- var fps = (1000 / 60);
61
+ var interval = 1/fps*1000;
726
-
727
-
728
-
729
- //配列
62
+
730
-
731
- var iconnum = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14];
63
+
732
-
733
- var iconlists = new Array();
734
-
735
- iconlists = iconnum;
736
64
 
737
65
  addSlots();
738
66
 
739
67
 
740
68
 
69
+ //BGM
70
+
71
+ SlotBGM.play();
72
+
73
+
74
+
75
+ $('#startbtn').click(function() {
76
+
77
+ $(this).css("pointer-events", "none");
78
+
79
+ slotstart();
80
+
81
+ });
82
+
83
+
84
+
85
+ $('[id^=stopbtn]').each(function(i){
86
+
87
+ $(this).click(function() {
88
+
89
+ $(this).css("pointer-events", "none");
90
+
91
+ slotStop(i);
92
+
93
+ });
94
+
95
+ });
96
+
97
+
98
+
99
+ function slotstart(){
100
+
101
+ reelStopArray = [false, false, false];
102
+
103
+ reelStopNum = 0;
104
+
105
+ var startSpeedcnt = 0;
106
+
107
+ reelstartAnime = setInterval(function(){
108
+
109
+ if(startSpeedcnt <= 60){
110
+
111
+ startSpeedcnt++;
112
+
113
+ for (var i = 0; i < reelNum; i++) {
114
+
115
+ reelposY[i] += Math.floor(iconHeight/reelHeight * startSpeedcnt);
116
+
117
+ $('.wrapper').eq(i).css("top", reelposY[i]+"px");
118
+
119
+ slip[i] -= Math.floor(iconHeight/reelHeight * 60);
120
+
121
+ if (reelposY[i] >= 0) reelposY[i] = -reelHeight;
122
+
123
+ }
124
+
125
+ }else{
126
+
127
+ clearInterval(reelstartAnime);
128
+
129
+ reelmoveAnime = setInterval(slotMove, interval);
130
+
131
+ $('[id^=stopbtn]').css("pointer-events", "auto");
132
+
133
+ }
134
+
135
+ },interval);
136
+
137
+ }
138
+
139
+
140
+
141
+ function slotStop(i){
142
+
143
+ if(reelStopNum <= reelNum){
144
+
145
+ reelStopNum++;
146
+
147
+ reelStopArray[i] = true;
148
+
149
+ }
150
+
151
+ if(reelStopArray[reelNum-1]) {
152
+
153
+ $('#startbtn').css("pointer-events", "auto");
154
+
155
+ clearInterval(reelmoveAnime);
156
+
157
+ }
158
+
159
+ SeStopBtn.play();
160
+
161
+ }
162
+
163
+
164
+
741
165
  //リール作成
742
166
 
743
167
  function addSlots() {
744
168
 
169
+ reelStopArray[i] = false;
170
+
745
- for (var i = 0; i < iconlists.length; i++) {
171
+ for (var i = 0; i < reelNum; i++) {
172
+
746
-
173
+ $('.reel').eq(i).css("left", ((iconWidth + reelMargin) * i)+"px");
174
+
175
+ $('.wrapper').eq(i).css("height", reelHeight+"px");
176
+
177
+ for (var j = 0; j < 24; j++) {
178
+
179
+ if(j < 21){
180
+
747
- $('.wrapper').append("<li class='icon" + iconlists[i] + "'></li>");
181
+ $('.wrapper').eq(i).append("<li class='icon icon" + iconArray[i][j] + "'>" + iconArray[i][j] + "</li>");
182
+
748
-
183
+ }else{
184
+
185
+ $('.wrapper').eq(i).append("<li class='icon icon" + iconArray[i][j - 21] + "'>" + iconArray[i][j - 21] + "</li>");
186
+
749
- }
187
+ }
750
-
188
+
751
- }
189
+ }
752
-
753
-
754
-
755
- var iconHeight = 120/2;
190
+
756
-
757
- var scrollSpeed = iconHeight/4; //リール速度
758
-
759
-
760
-
761
- var imgHeight = 1680; //リールの幅を入力する
762
-
763
- var posY = 0;
191
+ }
192
+
764
-
193
+ }
194
+
195
+
196
+
765
- //リール回転させる
197
+ //リール回転
766
-
198
+
767
- setInterval(function(){
199
+ function slotMove(){
200
+
768
-
201
+ for (var i = 0; i < reelNum; i++) {
202
+
769
- if (posY > 0) posY = -1680;
203
+ if (!reelStopArray[i]) {
770
-
204
+
771
- posY += scrollSpeed;
205
+ reelposY[i] += Math.floor(iconHeight/reelHeight * 60);
772
-
206
+
773
- $('.wrapper').css("top", posY+"px");
207
+ $('.wrapper').eq(i).css("top", reelposY[i]+"px");
208
+
774
-
209
+ slip[i] -= Math.floor(iconHeight/reelHeight * 60);
210
+
211
+ if (reelposY[i] >= 0) reelposY[i] = -reelHeight;
212
+
775
- }, fps);
213
+ }else{
214
+
215
+ //while((reelposY[i]%iconHeight+slip[i])%iconHeight!=iconHeight/2) {
216
+
217
+ // slip[i] += Math.floor(iconHeight/reelHeight * 60);
218
+
219
+ //}
220
+
221
+ }
222
+
223
+ }
224
+
225
+ }
776
226
 
777
227
  });
778
228
 
779
- -->
780
-
781
- </script>
782
-
783
- </head>
784
-
785
- <body>
786
-
787
- <div id="slotmachinebox">
788
-
789
- <div id="reelbox">
790
-
791
- <div id="reeledge"></div>
792
-
793
- <div id="reel" class="reel0">
794
-
795
- <ul class="wrapper">
796
-
797
- </ul>
798
-
799
- </div>
800
-
801
- <div id="reel" class="reel1">
802
-
803
- <ul class="wrapper">
804
-
805
- </ul>
806
-
807
- </div>
808
-
809
- <div id="reel" class="reel2">
810
-
811
- <ul class="wrapper">
812
-
813
- </ul>
814
-
815
- </div>
816
-
817
- <div id="reel" class="reel3">
818
-
819
- <ul class="wrapper">
820
-
821
- </ul>
822
-
823
- </div>
824
-
825
- <div id="reel" class="reel4">
826
-
827
- <ul class="wrapper">
828
-
829
- </ul>
830
-
831
- </div>
832
-
833
- </div>
834
-
835
- <div id="stopbtn">
836
-
837
- </div>
838
-
839
- </div>
840
-
841
- </body>
842
-
843
- </html>
844
-
845
229
  ```