954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

calling for a subroutine on vb6.0

uhm. im new to visual basic 6. im making a maze program, ones like those that pop up a scary picture or something. im having a bit of a trouble with calling a sub thing.im not really sure if thats what you call it.
program runs this way, as i run it, theres a start button that triggers a timer for the game. the paths for the mouse move, i used labels. if the mouse runs off a label and hits the exact form, the game will end or the player looses. but my problem is that i want to trigger the mousemove event right after i have clicked the start button that my game wont say game over right after i run it.

response would be really much appreciated.

i have this already :

Private Sub Command1_Click()
Label10.Visible = True -------------->> after this form_mousemove must perform.
End Sub


Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As  Single)------------------------->> this shouldn't perform upon running. it will only    perform after command1_click() 
MsgBox " GAME OVER!"
End Sub
yeeitsneo
Newbie Poster
22 posts since Sep 2011
Reputation Points: 10
Solved Threads: 1
 

Simplest way is just to test for Label10.Visible = True inside the Form_MouseMove event, like this:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Label10.Visible = True Then
    MsgBox "Game Over!"
End If
End Sub



However, that means that unless your button is overlapping your label, there's no way to get the mouse from your button to your Label without triggering the Form_MouseMove event.

Not knowing anything about your game, or how the controls work in it, I hesitate to offer any specific advice. You may want to look at the Game Development forum here for some ideas. Good luck!

BitBlt
Master Poster
711 posts since Feb 2011
Reputation Points: 367
Solved Threads: 109
 

Simplest way is just to test for Label10.Visible = True inside the Form_MouseMove event, like this:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Label10.Visible = True Then
    MsgBox "Game Over!"
End If
End Sub

However, that means that unless your button is overlapping your label, there's no way to get the mouse from your button to your Label without triggering the Form_MouseMove event.

Not knowing anything about your game, or how the controls work in it, I hesitate to offer any specific advice. You may want to look at the Game Development forum here for some ideas. Good luck!


thanks for the response! worked perfectly! :)))) cheers! by any chance sir do you know how to implement GIF's in vb 6?

yeeitsneo
Newbie Poster
22 posts since Sep 2011
Reputation Points: 10
Solved Threads: 1
 

Depends on what you mean by "implement", but yes. However, since it's a completely new subject you should start a new thread.

BitBlt
Master Poster
711 posts since Feb 2011
Reputation Points: 367
Solved Threads: 109
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: