Help with Mouse.Where
Author |
Message |
kznavy
|
Posted: Mon Feb 08, 2010 5:04 pm Post subject: 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)
<Answer Here>
Turing: |
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 := "[Forwards] (>O_O)>"
o := " <(O_O<) [Backwards]"
loop
if x = 0 then
flag := 1
i := 1
elsif x = 550 then
flag := 0
i := 1
end if
if flag = 1 then
x := x + 5
p := 47
Text.LocateXY (300, 300)
put t
elsif flag = 0 then
x := x - 5
p := 40
Text.LocateXY (300, 300)
put o
end if
Draw.FillArc (x,y, 10, 10, 0, 360,p )
delay (10)
cls
end loop
|
Please specify what version of Turing you are using
V. 4.1.1 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
TheGuardian001
|
Posted: Mon Feb 08, 2010 5:08 pm Post subject: 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.
Turing: |
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
|
Posted: Mon Feb 08, 2010 5:12 pm Post subject: Re: Help with Mouse.Where |
|
|
Alright thanks, i get how mousewhere works now
Also why oval :O
EDIT: also where should i put the piece of code >_< |
|
|
|
|
|
SNIPERDUDE
|
Posted: Mon Feb 08, 2010 5:16 pm Post subject: 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
|
Posted: Mon Feb 08, 2010 5:17 pm Post subject: 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
|
Posted: Mon Feb 08, 2010 5:21 pm Post subject: 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
|
Posted: Mon Feb 08, 2010 5:27 pm Post subject: Re: Help with Mouse.Where |
|
|
haha, alright Tux (:
I have taken in all your advice, now my "ball program" works like a charm
I'm glad i found this website
i'm probably going to come here again for future help :3 |
|
|
|
|
|
SNIPERDUDE
|
Posted: Mon Feb 08, 2010 5:49 pm Post subject: 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. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
USEC_OFFICER
|
Posted: Mon Feb 08, 2010 8:11 pm Post subject: 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
|
Posted: Mon Feb 08, 2010 9:42 pm Post subject: 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
|
Posted: Mon Feb 08, 2010 9:52 pm Post subject: 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
|
Posted: Tue Feb 09, 2010 8:32 am Post subject: Re: Help with Mouse.Where |
|
|
To answer your original question, what you have to do is very simple...
End of story
'That was Easy' |
|
|
|
|
|
USEC_OFFICER
|
Posted: Tue Feb 09, 2010 12:52 pm Post subject: 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) |
|
|
|
|
|
|
|