Well, I got the shot to display, but I cant get the thing to moveGood greif, lol
Here's my shot structure, the bullet fires at the angle of the ship:
vb Code:
Public Structure Shot Dim XPos As Int32 Dim YPos As Int32 Dim picbox As PictureBox Dim speed As Int32 Dim distance As Int32 Dim angle As Int32 Dim damage As Single Sub UpdateShot() Dim X, Y As Int32 X = -Math.Sin(angle * Math.PI / 180.0) * 3 Y = -Math.Cos(angle * Math.PI / 180.0) * 3 XPos = XPos + X YPos = YPos + Y picbox.Location() = New Point(XPos, YPos) 'Add your collision checking code here End Sub End Structure
Here's where the shot is created (mouse click):
vb Code:
x.picbox = New PictureBox x.picbox.Image = pctShot.Image x.picbox.SizeMode = PictureBoxSizeMode.AutoSize 'x.picbox.Location = New Point(500, 500) x.XPos = myShip.picbox.Location.X + (myShip.picbox.Width / 2) x.YPos = myShip.picbox.Location.Y + (myShip.picbox.Height / 2) x.speed = 3 x.distance = 500 x.picbox.Visible = True x.angle = myShip.angle Controls.Add(x.picbox) shotList.Add(x)
Background worker shot dowork:
vb Code:
For i = 1 To 2 bwShot.ReportProgress(i) If i = 2 Then i = 1 If bwShot.CancellationPending = True Then Exit For End If System.Threading.Thread.Sleep(30) Next
Background worker shot progress changed:
vb Code:
Dim y As Shot For Each y In shotList y.UpdateShot() Next
Now I can tell that it is making the shot because it's displaying it (where the ship is), but it's not moving. Through use of msgbox's I've determined that it's getting inside the updateshot routine, but nothing is changing. the updateshot code is basically the same code for the ships movement, only in this case the angle is constant (set to what angle the ship was at fireing). Any thoughts would be appreciated, I'm probably missing somthign obvious.




Good greif, lol
Reply With Quote