-
Ok, Say you wanted to make a small confusing game. I want to make a tiny program that has no background no x no nothing, just a button that says "click here," and when you put your cursor over the button it jumps arround the screen. I put my cursor on it it jumps ayay. I do it again it jumps away. Confusing? Well if someone can help me out can you tel me what the code is?
-
Would something like this work:
Code:
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Done As Boolean
Dim rndLeft As Long
Dim rndTop As Long
Randomize
Do While Not Done
rndLeft = Int((Me.Width * Rnd) + 1)
If (rndLeft + Command1.Width > Me.Width) Or (rndLeft < 0) Then
Done = False
Else
Done = True
End If
Loop
Done = False
Do While Not Done
rndTop = Int((Me.Height * Rnd) + 1)
If (rndTop + Command1.Height > Me.Height) Or (rndTop < 0) Then
Done = False
Else
Done = True
End If
Loop
Command1.Left = rndLeft
Command1.Top = rndTop
End Sub
It's very poorly written, but it's 5:15 in the morning and I didn't get my sleep yet. Take it as an idea.
HTH
-
make sure you don't set the button's default property to true, because all the user would have to do to press it is hit the enter key!
also, you will have to stop it appearing in the CTRL-ALT-DEL list.
You must be one of those subversive types!