Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 ressetting mouse coordinates
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
shoobyman




PostPosted: Tue Feb 07, 2006 7:25 pm   Post subject: ressetting mouse coordinates

okay i made this game and i need it to set the mouse coordinates to x=50 and y=50 each time you start it so that you don't cheat by putting your mouse at the other side when you start.
this is the code
[var x, y, button : int
x := 50
y := 50
setscreen ("offscreenonly")
loop
View.Update
cls
Mouse.Where (x, y, button)
drawline (155, 100, 155, 400, 7)
drawline (255, 100, 255, 400, 7)
drawline (355, 100, 355, 400, 7)
drawline (455, 100, 455, 400, 7)
drawline (555, 100, 555, 400, 7)

drawline (105, 0, 105, 300, 7)
drawline (205, 0, 205, 300, 7)
drawline (305, 0, 305, 300, 7)
drawline (405, 0, 405, 300, 7)
drawline (505, 0, 505, 300, 7)

drawfilloval (x, y, 5, 5, 7)

if x >= 100 and x <= 110 and y <= 305 then
exit
elsif x >= 200 and x <= 210 and y <= 305 then
exit
elsif x >= 300 and x <= 310 and y <= 305 then
exit
elsif x >= 400 and x <= 410 and y <= 305 then
exit
elsif x >= 500 and x <= 510 and y <= 305 then
exit
elsif x >= 150 and x <= 160 and y >= 95 then
exit
elsif x >= 250 and x <= 260 and y >= 95 then
exit
elsif x >= 350 and x <= 360 and y >= 95 then
exit
elsif x >= 450 and x <= 460 and y >= 95 then
exit
elsif x >= 550 and x <= 560 and y >= 95 then
exit
end if
end loop
][/code]
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue Feb 07, 2006 7:31 pm   Post subject: (No subject)

To move the position of the mouse, you have to access the OS's API. Turing can't do that.
iker




PostPosted: Tue Feb 07, 2006 10:57 pm   Post subject: (No subject)

Cervantes wrote:
To move the position of the mouse, you have to access the OS's API. Turing can't do that.

True, but what if as soon as the mouse goes out of the window (x<0, x>maxx, y<0, y>maxy), have the game exit aswell
codemage




PostPosted: Wed Feb 08, 2006 8:54 am   Post subject: (No subject)

Give the user a limited amount of time to move the mouse within the desired zone.
Dan




PostPosted: Wed Feb 08, 2006 1:53 pm   Post subject: (No subject)

Some ideas:

Pause the game when the mouse is out of the area u whont.

Use VB or another lang that can reset the mouse and make a very simple app that dose that as soon as you run it then call it from turing.

Make the player lose points or some other penty when out of the box

or the best idea i can think of is make a pointer in turing, a small box or somthing that gose w here the mouse dose but when the mouse gose out of the area u whont it will stay at the edge of that area in till the mouse comes back over it to "pick it up".

or maybe an even better idea whould be puting a buttion you have to click at (50,50) to start the game. If the user clicks a bottom at (50,50) to start it then they whould have to be there at the start.

or a modifed verson of this, put text saying move mouse to (50,50) to start game. And do not start the game intill the mouse is there. Whould probly be best to put a box there so they know where (50,50) is and give some them some error since it is hard to put it over on pixal.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
jrblast




PostPosted: Wed Feb 08, 2006 2:41 pm   Post subject: (No subject)

Good point Hacker Dan. I was actualy just coming here to post that (shooby told me bout his problem at school this morning.)

If you decide to use an external program in VB or somehting, I'll make it for ya' I need incentive to learn o.O Laughing
shoobyman




PostPosted: Wed Feb 08, 2006 4:16 pm   Post subject: (No subject)

thank you Hacker Dan, i think i will go with the idea of a button at (50,50), it seems like the best and it seems easier...
iker




PostPosted: Wed Feb 08, 2006 4:37 pm   Post subject: (No subject)

Hacker Dan wrote:

or maybe an even better idea whould be puting a buttion you have to click at (50,50) to start the game. If the user clicks a bottom at (50,50) to start it then they whould have to be there at the start.

or a modifed verson of this, put text saying move mouse to (50,50) to start game. And do not start the game intill the mouse is there. Whould probly be best to put a box there so they know where (50,50) is and give some them some error since it is hard to put it over on pixal.

That sparked an idea in my head... checkpoints
Have it so the mouse must be moved over the 'checkpoints' in an order, and if they go out of the window, they have to start over. Also, have it so the curser, if your going to use that, follows the mouse, not = the mouse, so if mousex > curserx then curserx +=1 or something like that, and that would realy make it cheater proof.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: