Computer Science Canada Turing Paint Program Help |
Author: | Rodzy [ Sat Jan 02, 2016 8:33 pm ] | ||
Post subject: | Turing Paint Program Help | ||
What is it you are trying to achieve? <Replace all the <> with your answers/code and remove the <>> What is the problem you are having? <Answer Here> Describe what you have tried to solve this problem <Answer Here> Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using <Answer Here> My program needs to have a paintbrush tool in it but I can not seem to understand how to get it to work. The line at the bottom that shows the boundaries of the canvas is where I need it to be entered. Any help will be greatly appreciated! |
Author: | Insectoid [ Sat Jan 02, 2016 8:41 pm ] |
Post subject: | RE:Turing Paint Program Help |
What have you tried so far? |
Author: | Rodzy [ Sat Jan 02, 2016 8:44 pm ] |
Post subject: | Re: RE:Turing Paint Program Help |
Insectoid @ Sat Jan 02, 2016 8:41 pm wrote: What have you tried so far?
All I've really tried is putting a drawoval with the mousewhere as the co-ordinates after the boundaries if statement at the end but all that happens is it draws 1 circle and not a continuous line |
Author: | Rodzy [ Sat Jan 02, 2016 8:53 pm ] |
Post subject: | RE:Turing Paint Program Help |
Using this if mx >= 140 and my >= 120 and mx <= 800 and my <= 500 and oldbutton = 0 and button = 1 and object = 9 then xanchor := mx yanchor := my elsif mx >= 140 and my >= 120 and mx <= 800 and my <= 500 and oldbutton = 1 and button = 1 and object = 9 then midx := (xanchor + mx) div 1 midy := (yanchor + my) div 1 drawfilloval (midx, midy, 2, 2, clr) end if Has worked but the line wont follow my mouse directly |
Author: | Insectoid [ Sat Jan 02, 2016 9:24 pm ] |
Post subject: | RE:Turing Paint Program Help |
First of all, what happens when you div something by 1? This probably isn't the cause of your problem, but it's something you should realize is silly when you're writing your code. The line won't follow the mouse because you never draw where the mouse is. Think about it, if your anchors are (10, 10) and the mouse is at (20, 20), where will the oval be drawn? |