Axe Software Forums
  Games and Chat
  Visual basic & friends


Author Topic:   Visual basic & friends
Jim Jones posted 18-01-2003 03:58 GMT     
quote:
I am making a game in visual basic (shut up all of you that are going to remark on my other post)and I need some help. I am trying to make it so every time a dice roll lands on 1 it makes a UFO come across. I put this post in chat since it doesn'y have anything to do with quest
Computer Whizz posted 18-01-2003 18:52 GMT          
Is there any explaination about putting your post in a [ quote ] box?

To solve your problem just have it so that when the dice "lands" on 1 set off a bit of code...

here you go:

Private Sub Form_load()

Randomize

End Sub

Private Sub cmdDice_click()
Dim intDiceRoll as Integer

intDiceRoll = Int(6 * Rnd + 1)
' This generates a number between 1 and 6

If (intDiceRoll = 1) then
#execute code#
End If

End Sub

Now obviously where #execute code# is, you'd have it so it moves your UFO around, or prints out some text - or whatnot.

Computer Whizz