|
-
May 14th, 2013, 09:59 AM
#1
Thread Starter
New Member
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)]
-
May 14th, 2013, 11:02 AM
#2
Re: Formsurface cover-up not working
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.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 14th, 2013, 01:53 PM
#3
Thread Starter
New Member
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.
-
May 14th, 2013, 02:11 PM
#4
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.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 15th, 2013, 09:33 AM
#5
Thread Starter
New Member
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?
-
May 15th, 2013, 10:39 AM
#6
Re: Formsurface cover-up not working
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
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
|