How do you move images with direction buttons..... anybody?

? Can some one explain how to, or show me a example of code like that. As far as what I mean by moving images, im talking about like for a pacman game for example.


  • Hi:

    That's really easy, you just need to use this: vbkeyright, vbkeyleft, vbkeyup and vbkeydown.

    Suppose that you have an image called Pacman. Ok, you have to write the code in the KeyDown event, something like this:

    Private Sub KeyDown(Key as Integer, Shift as Integer)
    Select Case key
    Case VbKeyRight
    Pacman.right = Pacman.right - 10
    Case VbKeyLeft
    Pacman.left = Pacman.left + 10
    End Select
    End Sub

    Maybe i made a little mistake in the KeyDown function definition, but i'm at work and dont Visual Basic...i writing what i can remember -:)
    Anyway, if you me to the send you a sample code, write me to with the subject "Moving an Image".

    Alvaro Tejada Galindo
    SinglePath games design

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion