Download presentation
Presentation is loading. Please wait.
Published byNickolas Morrison Modified over 9 years ago
1
學校 : 南台科技大學 姓名洪聖鈞 班級 : 車輛一甲 學號 :4A115057 指導老師 : 謝慶存 題目 : 抽牌比大小遊戲
2
抽牌小遊戲 在手機或電腦 上常常可以看到 這類的小遊戲,
3
程式碼 Public Class Form1 Dim pit, a, com Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Enabled = True Randomize() pit = Int(Rnd() * 13) + 1 If pit = 1 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s1.jpg") ElseIf pit = 2 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s2.jpg") ElseIf pit = 3 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s3.jpg") ElseIf pit = 4 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s4.jpg") ElseIf pit = 5 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s5.jpg")
4
ElseIf pit = 6 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s6.jpg") ElseIf pit = 7 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s7.jpg") ElseIf pit = 8 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s8.jpg") ElseIf pit = 9 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s9.jpg") ElseIf pit = 10 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s10.jpg") ElseIf pit = 11 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s11.jpg") ElseIf pit = 12 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s12.jpg") ElseIf pit = 13 Then PictureBox1.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s13.jpg") End If End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Randomize() com = Int(Rnd() * 13) + 1 a = a + 1 If a = 2 Then If com = 1 Then
5
PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s1.jpg") ElseIf com = 2 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s2.jpg") ElseIf com = 3 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s3.jpg") ElseIf com = 4 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s4.jpg") ElseIf com = 5 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s5.jpg") ElseIf com = 6 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s6.jpg") ElseIf com = 7 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s7.jpg")
6
ElseIf com = 8 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s8.jpg") ElseIf com = 9 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s9.jpg") ElseIf com = 10 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s10.jpg") ElseIf com = 11 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s11.jpg") ElseIf com = 12 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s12.jpg") ElseIf com = 13 Then PictureBox2.Image = Image.FromFile("C:\Users\User\Desktop\game (1)\game\game\ 紅 o 心 s13.jpg") End If If com > pit Then Label1.Text = " 你婢的 o 點 I 數 A 比 n 較 Mu 小 p , A 輸 e 掉 ? 了 F" ElseIf pit > com Then Label1.Text = " 你婢的 o 點 I 數 A 比 n 較 Mu 大 j , A 贏 1 了 F" End If Timer1.Enabled = False a = 0 End If End Sub End Class
7
心得感想 經過老師一番教導後,讓我學到更多 Visual Basic 的程式,在期末報 告中更學習到如何製作一個小遊戲,讓它完美運行, 並增加一些訊息。
8
參考文獻 1.Visual Basic 2010 2. 老師指導 3. vb 光碟
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.