Formsurface cover-up not working
I have a program where i am making a helicopter move across the screen using the formsurface. I have a timer, and every tick it moves in the direction that i click using the arrows(verticalmove and horizontalmove). At the beginning of the timer sub, i print my helicopter on the screen the color of the background, then the points move over, then print it out again the color the helicopter should be. For some reason, this isn't working. It never gets "erased." Any help is appreciated!
[Dim helicopterpoints() As Point = {New Point(x, y), etc......}
formsurface.FillPolygon(Brushes.SkyBlue, helicopterpoints)
x += horizontalmove
y += verticalmove
formsurface.FillPolygon(Brushes.Black, helicopterpoints)]
Re: Formsurface cover-up not working
Quote:
x += horizontalmove
y += verticalmove
How is that supposed to move anything? If you want to move a polygon then you have to reassign its drawing points. x and y here don't belong to anything related to the polygon in question so you simply redraw on the same spot over and over again.
There is actually no need to use this very old-fashioned method of painting the old position with the background and then painting the new position with your 'sprite'. You should use the timer tick to reassign the position co-ordinates and then force a repaint of the form so 'erasing' is done automatically. All the actual drawing should be in the Paint event handler for the form.
Re: Formsurface cover-up not working
No it works. It moves everywhere, and if i replace fillpolygon with fillrectangle, and then set that all up, it all runs great, just sticks out a little. Helicopter points' coordinates are all based on x and y. when you hit the arrow keys, it makes horizontalmove and verticalmove go up or down.
Re: Formsurface cover-up not working
I'll take your word for it. The answer to the question remains the latter half of my advice anyway.
Re: Formsurface cover-up not working
But is there a way to fix what I have easily? But not changing everything else and slowing it down?
Re: Formsurface cover-up not working