Computer Science Canada Array of Boxes |
Author: | Prince Pwn [ Fri Nov 03, 2006 12:51 pm ] | ||
Post subject: | Array of Boxes | ||
Is there a way so I can make the boxes keep up with my mouse? If you hold down the left mouse button and drag a box to the side really fast it stops holding. And how could I fix it so when I drag one box over another, the bottom box doesn't dissapear?
|
Author: | Clayton [ Fri Nov 03, 2006 4:40 pm ] |
Post subject: | |
The reason the box doesn't "stick" to the mouse is because your computer can't keep up with so many things working in the background (especially with Turing running ![]() |
Author: | Piro24 [ Fri Nov 03, 2006 5:36 pm ] |
Post subject: | |
If is all you want to do is draw something along with the mouse, it's simple. Use your Mouse.Where co ords (x,y,b) and plug them into the variables of the box ex. Mouse.Where (x,y,b) if b = 1 then drawoval (x,y,20,20black) end if |
Author: | Prince Pwn [ Sat Nov 04, 2006 10:33 am ] | ||
Post subject: | |||
Oh and I realised the reason why the box below the one dragged disappears, it doesn't really dissapear. It just hides ontop or goes underneath the box being dragged due to "if mouse touches box then locate middle of box on mouse pointer", found this out by looking at my updated code... But I wonder how I should solve it...
|
Author: | richcash [ Sat Nov 04, 2006 11:57 am ] | ||
Post subject: | |||
Why don't you just make a variable like clicked to ensure that only one box is controlled by the mouse at one time? And to make it stop controlling it (when the user lets go of the button), we just have a boolean variable like buttonUp to keep track of whether or not the mouse is clicked. When the mouse is unclicked, just reset the clicked variable to control no boxes. Something like this :
|
Author: | Prince Pwn [ Sat Nov 04, 2006 1:06 pm ] |
Post subject: | |
Sweet idea. And yours runs like 10x faster too and it doesn't clear when you overlap =) |
Author: | Prince Pwn [ Sat Nov 04, 2006 1:12 pm ] |
Post subject: | |
Wait, what is slowing mine down? |
Author: | richcash [ Sat Nov 04, 2006 1:44 pm ] |
Post subject: | |
I don't think mine is any faster, I even delayed it by 5. It's just that your first code only works when you go slow with the mouse (so it gives the illusion of being slow). Your second code has so much text, font and input slowing it down, and it also only works when you go slow. So I just think mine looks faster because it works. Make sure you understand that code, otherwise it's useless to you! ![]() |