投稿日 | : 2003/01/30(Thu) 17:03 |
投稿者 | : YY-TT |
Eメール | : |
URL | : |
タイトル | : スロットマシーンの判定について |
スロットマシーンのプログラムを作っています。
ストップを押して速度を落として止まるとこまでできたんですが、その後の当たり判定ができません。
picSlot1〜3 = 画像表示, imgSlot(0〜9) = picSlot1〜3に表示させる
lblTen = 当たったら点数表示する, txtMe = 当たったら文字列を表示する
cmdStart = スロットを動かす, cmdStop1〜3 = スロット停止
―――――――――――――――――――コード―――――――――――――――――――――――
Dim cnt_1 As Integer, cnt_2 As Integer, cnt_3 As Integer 'picSlot1, picSlot2, picSlot3用の変数
Dim slow_1 As Integer, slow_2 As Integer, slow_3 As Integer 'スロットの速度低下用の変数
Dim stop_1 As Integer, stop_2 As Integer, stop_3 As Integer 'スロットの停止用の変数
―――――――――――――――――――――――――――――――――――――――――――――
Private Sub cmdRe_Click()
lblTen.Caption = 0 '点数を0に戻す
txtMe.Text = "" 'txtMeを白紙にする
End Sub
―――――――――――――――――――――――――――――――――――――――――――――
Private Sub cmdStart_Click()
picSlot1.Picture = imgSlot(0).Picture
picSlot1.Picture = imgSlot(3).Picture
picSlot1.Picture = imgSlot(7).Picture
lblTen = 0
txtMe.Text = "" 'txtMeを白紙にする
cnt_1 = 0 '最初に表示するpictureの画像をIndex0にする
slow_1 = 0 'ストップを押して再びスロットの速度を下げるためにslow_1を初期化する
stop_1 = 0 'ストップを押して再びスロットを停止させるためにslow_1を初期化する
timTimer1.Interval = 50 '00.5秒でタイマーを回す
timTimer1 = True 'timTimer1を起動する
cnt_2 = 2 '最初に表示するpictureの画像をIndex2にする
slow_2 = 0 'ストップを押して再びスロットの速度を下げるためにslow_2を初期化する
stop_2 = 0 'ストップを押して再びスロットを停止させるためにslow_2を初期化する
timTimer2.Interval = 50 '00.5秒でタイマーを回す
timTimer2 = True 'timTimer2を起動する
cnt_3 = 5 '最初に表示するpictureの画像をIndex5にする
slow_3 = 0 'ストップを押して再びスロットの速度を下げるためにslow_3を初期化する
stop_3 = 0 'ストップを押して再びスロットを停止させるためにslow_3を初期化する
timTimer3.Interval = 50 '00.5秒でタイマーを回す
timTimer3 = True 'timTiemr3を起動する
End Sub
―――――――――――――――――――――――――――――――――――――――――――――
Private Sub cmdStop1_Click()
slow_1 = 1 'ストップを押したら回転の速度を下げるためにslow_1に1を代入する
End Sub
―――――――――――――――――――――――――――――――――――――――――――――
Private Sub cmdStop2_Click()
slow_2 = 1 'ストップを押したら回転の速度を下げるためにslow_2に1を代入する
End Sub
―――――――――――――――――――――――――――――――――――――――――――――
Private Sub cmdStop3_Click()
slow_3 = 1 'ストップを押したら回転の速度を下げるためにslow_3に1を代入する
End Sub
―――――――――――――――――――――――――――――――――――――――――――――
Private Sub timTimer1_Timer()
picSlot1.Picture = imgSlot(cnt_1).Picture 'imageの画像をpictureに表示する
cnt_1 = cnt_1 - 1 'picSlot1に画像が表示されたらcnt_1に1を加算する
If cnt_1 < 0 Then 'picSlot1に画像が10回表示されたら
cnt_1 = 9 'imageのIndexが9までしかないのでcnt_1を0に戻す
End If
If slow_1 = 1 Then 'ストップを押して回転の速度が遅くなる
timTimer1.Interval = timTimer1.Interval + 50 'スロットが一回転するごとにpictureの画像の速度を0.05秒上げる
picSlot1.Picture = imgSlot(cnt_1).Picture 'imageの画像をpictureに表示する
cnt_1 = cnt_1 - 1 'picSlot1(0)に画像が表示されたらcnt_1に1を加算する
If cnt_1 < 0 Then 'picSlot1に画像が10回表示されたら
cnt_1 = 9 'imageのIndexが9までしかないのでcnt_1を0に戻す
End If
stop_1 = stop_1 + 1 'スロットが一回転するごとにstop_1に1を加算していく
End If
If stop_1 = 10 Then 'ストップを押した後スロットが10回転したら
timTimer1.Enabled = False 'timTimer1を停止する
ten_1 = 1 '判定をするためにten_1に1を代入する
End If
End Sub
―――――――――――――――――――――――――――――――――――――――――――――
Private Sub timTimer2_Timer()
picSlot2(0).Picture = imgSlot(cnt_2).Picture 'imageの画像をpictureに表示する
cnt_2 = cnt_2 - 1 'picSlot2に画像が表示されたらcnt_2に1を加算する
If cnt_2 < 0 Then 'picSlot2に画像が10回表示されたら
cnt_2 = 9 'imageのIndexが9までしかないのでcnt_2を0に戻す
End If
If slow_2 = 1 Then 'ストップを押して回転の速度が遅くなる
timTimer2.Interval = timTimer2.Interval + 50 'スロットが一回転するごとにpictureの画像の速度を0.05秒上げる
picSlot2.Picture = imgSlot(cnt_2).Picture 'imageの画像をpictureに表示する
cnt_2 = cnt_2 - 1 'picSlot2に画像が表示されたらcnt_2に1を加算する
If cnt_2 < 0 Then 'picSlot2に画像が10回表示されたら
cnt_2 = 9 'imageのIndexが9までしかないのでcnt_2を0に戻す
End If
stop_2 = stop_2 + 1 'スロットが一回転するごとにstop_2に1を加算していく
End If
If stop_2 = 10 Then 'ストップを押した後スロットが10回転したら
timTimer2.Enabled = False 'timTimer2を停止する
ten_2 = 1 '判定をするためにten_2に1を代入する
End If
End Sub
―――――――――――――――――――――――――――――――――――――――――――――
Private Sub timTimer3_Timer()
picSlot3.Picture = imgSlot(cnt_3).Picture 'imageの画像をpictureに表示する
cnt_3 = cnt_3 - 1 'picSlot3に画像が表示されたらcnt_3に1を加算する
If cnt_3 < 0 Then 'picSlot3に画像が10回表示されたら
cnt_3 = 9 'imageのIndexが9までしかないのでcnt_3を0に戻す
End If
If slow_3 = 1 Then 'ストップを押して回転の速度が遅くなる
timTimer3.Interval = timTimer3.Interval + 50 'スロットが一回転するごとにpictureの画像の速度を0.05秒上げる
picSlot3.Picture = imgSlot(cnt_3).Picture 'imageの画像をpictureに表示する
cnt_3 = cnt_3 - 1 'picSlot3に画像が表示されたらcnt_3に1を加算する
If cnt_3 < 0 Then 'picSlot3に画像が10回表示されたら
cnt_3 = 9 'imageのIndexが9までしかないのでcnt_3を0に戻す
End If
stop_3 = stop_3 + 1 'スロットが一回転するごとにstop_3に1を加算していく
End If
If stop_3 = 10 Then 'ストップを押した後スロットが10回転したら
timTimer3.Enabled = False 'timTimer3を停止する
End If
End Sub
―――――――――――――――――――――終わり―――――――――――――――――――――
スロットがそろったら判定してlblTenに点数を表示させるにはどうすれば良いのでしょうか?