below is a project i am working on can someone help me i need to make the bell object move around the frame when i press the start button.VB Code:
Private Sub cmdDown_Click() imgHand.Top = imgHand.Top + 100 'moves image down If imgHand.Top > 4000 Then imgHand.Top = 3900 'stops the image from leaving the frame Call collission End Sub Private Sub cmdExit_Click() End 'ends program End Sub Private Sub cmdLeft_Click() imgHand.Left = imgHand.Left - 100 'moves the image left If imgHand.Left < 0 Then imgHand.Left = 480 'stops the image from leaving the frame Call collission End Sub Private Sub cmdRight_Click() imgHand.Left = imgHand.Left + 100 'moves the image right If imgHand.Left > 9000 Then imgHand.Left = 8900 'stops the image from leaving the frame Call collission End Sub [COLOR=Blue]Private Sub cmdStart_Click() imgBell.Visible = False End Sub[/COLOR] Private Sub cmdUp_Click() imgHand.Top = imgHand.Top - 100 'moves image up If imgHand.Top < 0 Then imgHand.Top = 120 'stops the image from leaving the frame Call collission End Sub Private Sub collission() If imgBell.Top + imgBell.Height >= imgHand.Top - 100 _ And imgBell.Top <= imgHand.Top + imgHand.Height + 100 _ And imgBell.Left + imgBell.Width >= imgHand.Left - 100 _ And imgBell.Left <= imgHand.Left + imgHand.Width + 100 Then imgBell.Visible = True 'this is the collission programe MsgBox " ouch! " 'the message will appear when the objects collides End If End Sub
Edit: Added [vbcode][/vbcode] tags for more clarity. - Hack




Reply With Quote