-
May 11th, 2014, 10:30 AM
#1
Thread Starter
Junior Member
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
-
May 11th, 2014, 10:35 AM
#2
Re: picture box is shaking when moving on the X axis (VB 2010)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|