Computer Science Canada Help making Spray Can effect for paint program |
Author: | Neja [ Sun Jan 18, 2004 7:01 pm ] |
Post subject: | Help making Spray Can effect for paint program |
I need to make a spray can effect ( random dots) around where th user clicks. I need an idea on how to do it or at least how to have a set perimeter. For example, if a user clicks on the coordianates (10,151) how would I make it so that in a small area around said coordnates is filled with dots? I've fooled around for a bit with it, and I haven't gotten very far. I've been using Rand.Int. |
Author: | Andy [ Sun Jan 18, 2004 7:24 pm ] | ||
Post subject: | |||
here, nxt time post ur attempts
|
Author: | Neja [ Sun Jan 18, 2004 7:39 pm ] |
Post subject: | |
Thank you. Um, but could you explain proc spray? I'm not really able to follow it. |
Author: | Andy [ Sun Jan 18, 2004 7:42 pm ] |
Post subject: | |
well basicly i randomly generate dots and plug them in the circle formula to make sure they form a circle |
Author: | McKenzie [ Sun Jan 18, 2004 9:43 pm ] | ||
Post subject: | |||
What Dodge is saying is: If we did a randint from -20 to 20 in both x and y from some point we would get a square. eg.
If you want to ensure that they fall in a circle you use the equation of a circle (you can even understand the math with just pythagorean theorem.) From there Dodge makes a very generic procedure to use with any location and any radius. |
Author: | Neja [ Sun Jan 18, 2004 10:57 pm ] |
Post subject: | |
Thank you 'Dodge' & Mr.Mckenzie. |
Author: | Pickles [ Sat Apr 17, 2004 1:49 pm ] | ||
Post subject: | also need help | ||
Im making the spray paint (Right now I just have it as a square, but i can make it into a circle later.) The problem I run into is the GUI.DrawDot part on the canvas. To start off the spray can works but is not set at the mouse position, instead it is set up and to the right, and i cant figure out how to get it so its always with the mouse. Another problem is that the dots draw really slow. And finally, I cant click any other buttons after I have used the spray can, its still using it while im trying to click buttons to change. If I use Draw.Dot it starts where the mouse is and everything, and draws fast enough.. Why is it different with GUI? |
Author: | Pickles [ Sat Apr 17, 2004 4:13 pm ] |
Post subject: | .. |
Ive come to realize that the amount is off by is where the canvas starts.. By that i mean to say, that if i click at the bottom left corner of the run window it will be at the bottom left corner of the canvas, and will always be that distance away from my mouse |
Author: | Tony [ Sat Apr 17, 2004 5:19 pm ] | ||||
Post subject: | |||||
Here's how GUI's DrawDot works
So yes, it does draw relative to the bottom left corner of the canvas. If you want to draw using global values you should use
|
Author: | Pickles [ Sat Apr 17, 2004 9:16 pm ] |
Post subject: | Thank you |
Thank you ever so much, the only other Question i would have about it would be is there a way to increase the speed in which they draw the dots ? I dont have a delay in there or anything now. and it seems slugish.. |
Author: | Tony [ Sat Apr 17, 2004 9:23 pm ] | ||
Post subject: | |||
well you could try using Draw.Dot instead of GUI.DrawDot. It will bypass BeforeDraw and AfterDraw which should speed up the procedure. Though I'm not sure what those two calls do or how it will affect your program Maybe what you could do is to write your own procedure that does all the draw dots at same time for your spray effect? Such as
This way before/after procedures get called just once. Though you'd have to go into your GUI module file and make those two procedures exportable. I'm preaty sure they're internal at the moment. |
Author: | the_short1 [ Sun Apr 18, 2004 4:30 pm ] | ||
Post subject: | |||
cool..... i just had my paintcan effect from my paint program to be
that drew 25 dots around the mouse position.... i didn;t realy venture into the circle deal... Thanks DODGE!!!... thats a nice way to do that... i like it a lot... NOTE: im really good in math... i just not good at getting it into turing |
Author: | TheZsterBunny [ Sun Apr 25, 2004 3:01 pm ] | ||
Post subject: | |||
heh. this takes me back to my spray can days:
i wish i'd known the circle formula then. |
Author: | Paul [ Sun Apr 25, 2004 3:18 pm ] |
Post subject: | |
whats at the bottom left corner? u can't draw there. |
Author: | the_short1 [ Sun Apr 25, 2004 5:34 pm ] |
Post subject: | |
OMG!!!!! i did NOT know of drawfill.... that is AWSOME!!! that will make my paint prog bettter... also.... that is EXACTLY what i needed for my Jezzball program!!!! **i know colors of wall so thats good... [color=blue]+BITS[/c] ZesterBunny .... ummm.... though of a hitch,.,,, getting it to fill an area until it hits anycolor other then the one that was clicked on... (non-specific) any ideas??... |