Tutorials    Freebies    Links    Feedback    Thank me
Agent Store   Agent Games   Legal notice    History
Home

Intro»»Part 1»»Part 2

How to use it

To demonstrate how the procedure can be used to get a character to move around an object, first add a command button to the form and call it cmdMove. Then add this code to the form:

Private Sub cmdMove_Click()
Dim MovePosition As Byte
'Sets up a variable to use in the example.
For MovePosition = 1 To 4
'Does the next set of code 4 times: starting _
at one, each time the value of _
MovePosition will be increased by one.

CharMove Genie, cmdMove, Me, MovePosition
'"CharMove" is the name of the procedure. _
"Genie" is the name of the character _
we're going to use. _
"cmdMove" is the name of the control _
Genie is going to move around. _
"Me" is used to represent the name of _
the form, so you don't have to type the full _
name of the form. _
"MovePosition" is the variable used to _
decide where Genie will move to.

Next
End Sub

If you want to change the speed at which the character will move, use the last (optional) parameter of the procedure, "Speed":

CharMove Genie, cmdMove, Me, MovePosition, 10000
'This will make Genie move very slowly. _
The higher the number, the slower Genie will go. _
Don't go above 32767, or you'll get an overflow error.

I hope you have enjoyed this tutorial. Please use the feedback form to send any comments about it to me.
If you would like to show your appreciation and support for The Agent LaunchPad, see the Thank me page.

Intro»»Part 1»»Part 2