
-----------------------------------
kznavy
Mon Feb 08, 2010 5:04 pm

Help with Mouse.Where
-----------------------------------
What is it you are trying to achieve?
Make the Y coordinatee of the ball depend on the Y coordinate of your mouse. Only Y


What is the problem you are having?
I do not know where to start.


Describe what you have tried to solve this problem
Failed attempt at using Mouse.Where


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




Alright so I'm just a grade 9 student looking for some help on turing! What i want to do is (look below) make y (height of the ball) depend on where your mouse is. I have something in mind to do with Mouse.Where? But i'm not sure..

setscreen ("graphics:600;600")
var x, y,flag, p,i,l : int
x := 0
y := 250
p := 0
flag := 0  
i := 0
l := 0
var t, o : string
t := "

Please specify what version of Turing you are using
V. 4.1.1

-----------------------------------
TheGuardian001
Mon Feb 08, 2010 5:08 pm

Re: Help with Mouse.Where
-----------------------------------
Well, mousewhere takes 3 values, x,y,and button. When it is called, it fills these values with the x coordinate, y coordinate, and the values of the button being pressed.


var mx, my, b : int

loop
    mousewhere(mx,my,b)
    locate(1,1)
    put "Mouse's Y coordinate: ", my
end loop


So once you have called mousewhere, whatever variable you pass to it for y can then be used as the y coordinate for your ball.

Oh, and instead of Draw.FillArc, you should probably be using Draw.FillOval

-----------------------------------
kznavy
Mon Feb 08, 2010 5:12 pm

Re: Help with Mouse.Where
-----------------------------------
Alright thanks, i get how mousewhere works now :D
Also why oval :O
EDIT: also where should i put the piece of code >_<

-----------------------------------
SNIPERDUDE
Mon Feb 08, 2010 5:16 pm

RE:Help with Mouse.Where
-----------------------------------
The term oval is used because you can have a different X radius than a Y radius, thus making an oval.  More commonly the two values are kept the same to make a circle.

-----------------------------------
kznavy
Mon Feb 08, 2010 5:17 pm

Re: Help with Mouse.Where
-----------------------------------
Alright thank you mr.linuxpenguin person :3!
So any idea where should i put this? before the loop? o.o

-----------------------------------
SNIPERDUDE
Mon Feb 08, 2010 5:21 pm

RE:Help with Mouse.Where
-----------------------------------
His name is Tux. :)
The Mouse.Where is kept inside the loop so it can continuously update the coordinates.  You would also want to draw your oval inside the loop (after getting the mouse x and y values) to continuously update it's position.

Don't forget to include "offscreenonly" in your setscreen command, it will remove the glitchiness.

-----------------------------------
kznavy
Mon Feb 08, 2010 5:27 pm

Re: Help with Mouse.Where
-----------------------------------
haha, alright Tux (:
I have taken in all your advice, now my "ball program" works like a charm :D
I'm glad i found this website :P
i'm probably going to come here again for future help :3

-----------------------------------
SNIPERDUDE
Mon Feb 08, 2010 5:49 pm

RE:Help with Mouse.Where
-----------------------------------
That's how I started.  In fact, I think it was the same (or similar) assignment that directed me to this site.
All in all just about anything programming question you can think of has been answered here, or can be.

-----------------------------------
USEC_OFFICER
Mon Feb 08, 2010 8:11 pm

RE:Help with Mouse.Where
-----------------------------------
Yesm it is a very good site. That reminds me, I have to spam the site with my (good!) programs.

-----------------------------------
kznavy
Mon Feb 08, 2010 9:42 pm

Re: Help with Mouse.Where
-----------------------------------
Mmkay guys (:
happy to know people are willing to help ^__^''
I have a question though: i have questions but i don't want to keep posting on this because people might get annoyed seeing nooby questions, does anyone have msn or something so i don't have to keep posting new threads D:

-----------------------------------
SNIPERDUDE
Mon Feb 08, 2010 9:52 pm

RE:Help with Mouse.Where
-----------------------------------
If you look on the bottom of people's threads or on their profile they might have a link up to their MSN.  If not, they are not likely going to give it to you.

Another way is PMing.  You can private message anyone on this site.

The best way however is to delve into the tutorials (notably the Turing Walkthrough) and the help forums to see if someone already asked your question.  If you;re lazy there is always the search feature.

-----------------------------------
Turing_Gamer
Tue Feb 09, 2010 8:32 am

Re: Help with Mouse.Where
-----------------------------------
To answer your original question, what you have to do is very simple...
var x, y, button : int

loop
    Mouse.Where (x, y, button)
    Draw.FillOval (100, y, 10, 10, red)
end loop

End of story :lol: 
'That was Easy'  :wink:

-----------------------------------
USEC_OFFICER
Tue Feb 09, 2010 12:52 pm

RE:Help with Mouse.Where
-----------------------------------
Um, no. You need Draw.Cls () to clear the screen to prevent you from drawing a line. Then you'll also need View.Set ("offscreenonly") to prevent annoying screen flicker. But that still is very little. (The Draw.Cls () goes in the game loop, the View.Set before)
