Membuat Game Tambah - Tambahan Dengan Gambas

Langsung aja deh biar ga ribet, pertama buat dulu form kayak gini


Habis itu masukkan kode script dibawah ini

' Gambas class file

PUBLIC SUB Form_Open()

  label1.Caption = Int(Rnd * 20) + 10
  label3.Caption = Int(Rnd * 20) + 10
  Button2.Enabled = FALSE

END

PUBLIC SUB Button1_Click()

  Button2.Enabled = TRUE
  Button1.Enabled = FALSE
  TextBox1.Enabled = FALSE
  IF TextBox1.Text = Val(label1.Caption) + Val(label3.Caption) THEN
  Message("Selamat! Anda Benar, score anda +1", "Oce")
  label6.Caption = Val(label6.Caption) + 1
  TextBox2.Text = Val(TextBox2.Text) + 1
  ELSE
  Message("Maaf! Anda Salah, score anda -1", "Oce")
  label7.Caption = Val(label7.Caption) + 1
  TextBox2.Text = Val(TextBox2.Text) - 1
  ENDIF
 
END

PUBLIC SUB Button2_Click()
 
  DIM a, b AS Integer
  Button1.Enabled = TRUE
  Button2.Enabled = FALSE
  TextBox1.Enabled = TRUE
  TextBox1.SetFocus
  FOR a = 1 TO a + 1
    label1.Caption = Int(Rnd * 20) + 10
    label3.Caption = Int(Rnd * 20) + 10
  NEXT
  TextBox1.Text = ""
 
END

PUBLIC SUB Button3_Click()

  QUIT

END

PUBLIC SUB Button4_Click()

  DIM Pesan AS String
    Pesan = Pesan & "Game Tebak Jawaban Versi 1.0.0 Beta" & Chr(13) & Chr(13)
    Pesan = Pesan & "Email: afiyandevorawali@gmail.com " & Chr(13)
    Pesan = Pesan & "website: http://afiyandevorawali.blogspot.com" & Chr(13)
    Pesan = Pesan & "      " & Chr(13) & Chr(13)
    Pesan = Pesan & "created by : Afiyan Devo Rawali" & Chr(13)
    Pesan = Pesan & "--------------------------------------------------" & Chr(13)
    Pesan = Pesan & "design in gambas" & Chr(13)

  Message(Pesan, "okey bos?")

END

PUBLIC SUB Menu3_Click()

  QUIT

END

PUBLIC SUB Menu2_Click()

  Message("Tinggal masukkan jawabannya di dalam kolom kemudian klik 'cek jawaban' ", "ok")

END

Kode script tadi bisa di-edit sesuka hati, jika masih ada bug silahkan di comment.

1 komentar:

Copyright © 2013 My Idea and Blogger Templates - Anime OST.