Results 1 to 2 of 2

Thread: picture box is shaking when moving on the X axis (VB 2010)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2014
    Posts
    30

    picture box is shaking when moving on the X axis (VB 2010)

    hello everyone, i am making a zombie game in VB 2010 and i made it so the zombies picture box will come after my picture box. Everything works except when it moves left and right. It bounces/shakes when it moves and doesnt show the right sprite. it looks like when it moves left or right it actually moves up and down because it shows those sprites. i havent tried anything because i have no idea what i can do to fix it.

    dim enspeed as integer = 7

    If picboxenemy.Location.X > picbox1.Location.X Then
    picboxenemy.Location = New Point(picboxenemy.Location.X - enspeed, picboxenemy.Location.Y)
    Select Case newpositon
    Case 0
    Me.picboxenemy.Image = My.Resources.aleft1
    Case 1
    Me.picboxenemy.Image = My.Resources.aleft2
    Case 2
    Me.picboxenemy.Image = My.Resources.aleft3
    End Select
    ElseIf picboxenemy.Location.X < picbox1.Location.X Then
    picboxenemy.Location = New Point(picboxenemy.Location.X + enspeed, picboxenemy.Location.Y)
    Select Case newpositon
    Case 0
    Me.picboxenemy.Image = My.Resources.aright1
    Case 1
    Me.picboxenemy.Image = My.Resources.aright2
    Case 2
    Me.picboxenemy.Image = My.Resources.aright3
    End Select
    End If

    If picboxenemy.Location.Y > picbox1.Location.Y Then
    picboxenemy.Location = New Point(picboxenemy.Location.X, picboxenemy.Location.Y - enspeed)
    Select Case newpositon
    Case 0
    Me.picboxenemy.Image = My.Resources.aup1
    Case 1
    Me.picboxenemy.Image = My.Resources.aup2
    Case 2
    Me.picboxenemy.Image = My.Resources.aup3
    End Select
    Else
    picboxenemy.Location = New Point(picboxenemy.Location.X, picboxenemy.Location.Y + enspeed)
    Select Case newpositon
    Case 0
    Me.picboxenemy.Image = My.Resources.adown1
    Case 1
    Me.picboxenemy.Image = My.Resources.adown2
    Case 2
    Me.picboxenemy.Image = My.Resources.adown3
    End Select
    End If

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: picture box is shaking when moving on the X axis (VB 2010)

    Thread closed. Duplicate thread can be found here: http://www.vbforums.com/showthread.p...ement-problems

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