Results 1 to 3 of 3

Thread: moving and grooving

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    21
    Can somebody please post a script which has...

    buttons that move a picture or icon around the screen
    when the icon or picture touches something a MsgBox appears

    please? no? go on? cheers

  2. #2
    Addicted Member
    Join Date
    Feb 2000
    Location
    CWMBRAN,WALES,UK
    Posts
    146
    This will give you something to play with. This code is very basic and could be coded more efficiently, but will demonstrate simple movement.

    Size a form at 7995 width x 7680 height
    Place a small image 480 x 480 and set TOP to 5640
    and LEFT to 480.
    Add commmand button and use the following code for it

    (This is a continuous loop by using the label continue


    code...

    continue:

    'move bottom left to bottom right
    Do
    img1.Left = img1.Left + 2 '2 sets the speed
    DoEvents
    Loop Until img1.Left = 7200

    'This should give you some ideas
    If img1.Left = 7200 Then
    MsgBox "Ouch", , "Title"
    End If

    'move bottom right to top right
    Do
    img1.Top = img1.Top - 2
    DoEvents
    Loop Until img1.Top = 360

    'move top right to top left
    Do
    img1.Left = img1.Left - 2
    DoEvents
    Loop Until img1.Left = 120

    'move top left to bottom left
    Do
    img1.Top = img1.Top + 2
    DoEvents
    Loop Until img1.Top = 5640

    'move bottom left to top right
    Do
    img1.Move img1.Left + 2, img1.Top - 2
    DoEvents
    Loop Until img1.Top = 360: 'shp1.Left

    'move top right to centre
    Do
    img1.Move img1.Left - 2, img1.Top + 2
    DoEvents
    Loop Until img1.Left = 2200

    'move centre to right
    Do
    img1.Left = img1.Left + 2
    DoEvents
    Loop Until img1.Left = 5200 '**

    'move right to top
    Do
    img1.Top = img1.Top - 2
    DoEvents
    Loop Until img1.Top = 360

    'move top to left
    Do
    img1.Left = img1.Left - 2
    DoEvents
    Loop Until img1.Left = 120

    'move top left to bottom left
    Do
    img1.Top = img1.Top + 2
    DoEvents
    Loop Until img1.Top = 5640

    'go through the loops again when the image
    'has reached the start position
    If img1.Left = 120 Then GoTo continue

    Experiment and above all have FUN

    GRAHAM

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    21
    cheers graham! that was quite a help..

    is there any way i can make the image move manually? so like when you press left the image moves left one?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width