I have this code for placing food in my snake game, but it is not working.
It says the structure 'system.drawing.point' has no default property.
How can I solve this?Code:Public Sub PlaceNewFood(Optional ByVal EmptyCell As Boolean = False) Dim rng As New Random Dim fx, fy As Integer Dim f As Integer = 1 Dim foodpoint As Point Dim b As New Bitmap(512, 256) Dim g As Graphics = Graphics.FromImage(b) fx = rng.Next(0, PictureBox1.Width) fy = rng.Next(0, PictureBox1.Height) foodpoint.X = fx foodpoint.Y = fy For i As Integer = 0 To m - 1 p(i) = p(i + 1) g.FillRectangle(Brushes.Black, New Rectangle(foodpoint(fx, fy), New Size(16, 16))) Next g.FillRectangle(Brushes.Black, New Rectangle(foodpoint(fx, fy), New Size(16, 16))) g.Dispose() PictureBox1.Image = b Me.Refresh() Me.Refresh() End Sub




Reply With Quote