VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Ball

by Ben Doherty (5 Submissions)
Category: Games
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (1 Votes)

This is a very simple code that allows you to move an image with
your arrow keys or the #s 8,6,4, and 2.

Assumes
I assume that you made your own image to move with the arrow keys Note: you can change the speed of the ball by changing the number after the plus or minus sign

Rate Ball

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'you can change the speed of the ball by changing the numbers after the + and - signs
If KeyCode = vbKeyF1 Then
MsgBox ("Created by Ben Doherty, [email protected] or http://www.mindspring.com/~jake-d/vb/")
End If
If KeyCode = vbKeyUp Then
Image1.Top = Image1.Top - 30
End If
If KeyCode = vbKeyDown Then
Image1.Top = Image1.Top + 30
End If
If KeyCode = vbKeyLeft Then
Image1.Left = Image1.Left - 30
End If
If KeyCode = vbKeyRight Then
Image1.Left = Image1.Left + 30
End If
End Sub

Private Sub Form_Load()
End Sub

Download this snippet    Add to My Saved Code

Ball Comments

No comments have been posted about Ball. Why not be the first to post a comment about Ball.

Post your comment

Subject:
Message:
0/1000 characters