Computer Science Canada filling in space btween lines. |
Author: | Bunny_Man_OC [ Mon Jan 22, 2007 1:21 pm ] |
Post subject: | filling in space btween lines. |
Hi, in my game, i ave a ship that draws line. and i have that working fine now, anywyas, when he tuouches a border, his line will turn blue. now whe his line turns blue I want ti to fill inall the area with blue. i cant think of a way for ti to know where these lines are drawn so it can fill it in. and not onyly that it has certain restrictions on that. there are birds flaying around in my game. and when a bird is inside the sapce where the blue coudl be dra it is not to be drawn. so i have to check whetehr or not there is a bird inside of the box. does anyone understand? if not go to google and search fill-it and have a go at that, I'm trying to re make it on turnng. and I have everything but filling in the space finished. i oly hva e 1 week left till i have to hand in the program fro evealutation. |
Author: | Cervantes [ Mon Jan 22, 2007 2:07 pm ] |
Post subject: | RE:filling in space btween lines. |
So, you have a ship that you can move around and it leaves a line behind it, and you have to enclose some birds inside the line you leave behind? Is that it? If so, are the lines you leave linear, or are they curved? If they are linear, then you can do this without too much trouble. You'll have to record all the vertices (using a flexible array (or see part 3 of this tutorial) of a record. Then do a bit of math to determine if a given point is contained within your polygon. Work the math out on paper. This is a good problem. Give it a shot, and let us know what you come up with, so we can offer advice. |
Author: | Bunny_Man_OC [ Mon Jan 22, 2007 5:09 pm ] |
Post subject: | Re: RE:filling in space btween lines. |
Cervantes @ Mon Jan 22, 2007 2:07 pm wrote: So, you have a ship that you can move around and it leaves a line behind it, and you have to enclose some birds inside the line you leave behind? Is that it?
If so, are the lines you leave linear, or are they curved? If they are linear, then you can do this without too much trouble. You'll have to record all the vertices (using a flexible array (or see part 3 of this tutorial) of a record. Then do a bit of math to determine if a given point is contained within your polygon. Work the math out on paper. This is a good problem. Give it a shot, and let us know what you come up with, so we can offer advice. yes the lines ar linear. but i have to fill in the polygon thtat DOESNT contain the bird. how exactly would i fill it in, though? I guess if i take some time tomarrow I might be able to work it out on paper. anyways , thanks for th ehelp, i'lk let you know if i come up with anything tomarrow |
Author: | Clayton [ Mon Jan 22, 2007 6:51 pm ] |
Post subject: | Re: filling in space btween lines. |
how about Draw.Fill()? |
Author: | Bunny_Man_OC [ Tue Jan 23, 2007 1:49 am ] |
Post subject: | Re: filling in space btween lines. |
Freakman @ Mon Jan 22, 2007 6:51 pm wrote: how about Draw.Fill()?
I'll prolly use fill.drawpolygon. my problem is mor eor less, how to go about drawing it, cause the shape cam be anything... |
Author: | Tycoon [ Tue Jan 23, 2007 7:23 am ] |
Post subject: | Re: filling in space btween lines. |
What I think he is doing is that you can move your ship all over the screen and it leaves a line behind it. But once you enclose the shape you are drawing, by connecting the ling to itself, it will fill in the shape with blue. So basically, if you were you take your ship and make a circle, it would then fill in your trail as a cycle. |