Computer Science Canada Determining the color of an object |
Author: | Banished_Outlaw [ Fri May 04, 2007 9:44 pm ] |
Post subject: | Determining the color of an object |
How can i determine the color of an object i drew? I have a program in which rain drops are falling down. They are in a loop and I cannot use cls to erase the droplets because that erases everything i have in the background. The only other way i could think of is to draw the raindrops again with their color matching the color of the object drawn in the background so that it appears that they have vanished. Can anyone tell me how i can do this? |
Author: | Cervantes [ Fri May 04, 2007 10:19 pm ] |
Post subject: | RE:Determining the color of an object |
You have two options, as I see it. One is to record the data about what you have drawn. That is, store the colour and position of the rain drops that have already been drawn, then cls and redraw them. The other option is to use whatdotcolour. Without further knowledge of your purpose, I don't think I can decide which is better. The answer to your initial question is whatdotcolour, but I suspect storing the data is better for your purposes. |
Author: | Banished_Outlaw [ Sat May 05, 2007 5:35 pm ] | ||
Post subject: | Re: Determining the color of an object | ||
How do i record the color of the objects i draw? I dont think i can use cls because cls clears everything and i do not want that happening. This is what i have so far:
|
Author: | Cervantes [ Sat May 05, 2007 7:38 pm ] |
Post subject: | RE:Determining the color of an object |
I'm saying you record the data, cls, then redraw it. To record the data, you'd probably want to use a flexible array of records. Check out the [Turing Walkthrough] for links to tutorials on these subjects. Also, please, don't use processes. It is not necessary for something like this, and there are many downsides to them. Read more here. |
Author: | Geostigma [ Sat May 05, 2007 10:22 pm ] |
Post subject: | RE:Determining the color of an object |
Why can't you use cls again? have your rain drops in a array and if spawns a drop then have a procedure to make it move x amount of pixels... |
Author: | Banished_Outlaw [ Sun May 06, 2007 9:30 am ] |
Post subject: | Re: Determining the color of an object |
But this is supposed to be a fairly easy project where I only have to draw some stuff. A bit of animation is allowed and we also have not covered records yet. I read the walk through and its really helpful but I don't want to spend time making records as it is due tomorrow. But thanks a lot for your help. You guys really know a lot. I'm just probably gonna let the rain drops stay on the screen or remove the rain and make a lightning thing in a process and fork it. |
Author: | Cervantes [ Sun May 06, 2007 11:02 am ] |
Post subject: | RE:Determining the color of an object |
As you wish, but that's a really awful way to do it. It hurts my head to consider it. ![]() |
Author: | Banished_Outlaw [ Mon May 07, 2007 9:35 pm ] |
Post subject: | Re: Determining the color of an object |
lol dun worry i got really good marks on the project...just gotta do some more commenting...and a pseudocode...but we have started doing records and two dimensional arrays now..so if i get time i will try making the program better ![]() |