
-----------------------------------
Jay316
Wed Jun 22, 2005 6:36 pm

Coordinates
-----------------------------------
how do i specifically know what part of the screen is which. how do i make a square in the middle or in the top left of the screen in turing? if someone can please help me..thanks!

-----------------------------------
[Gandalf]
Wed Jun 22, 2005 6:45 pm


-----------------------------------
Alright, here's the simple way to know generally.

I hope you know from math that x is _ horizontal and y is | vertical.  0x0y is at the bottom left hand corner of the screen.  Maximumx and maximumy is top right corner of the screen.  We see this when using: maxx and maxy.  Try it,
put maxx
put maxy

So to find the center of the screen we would divide maxx / 2 and maxy / 2.

Use this program to figure out the coordinates on the screen using the mouse:
var x, y, button : int %vars for the mouse where code
loop %needs to be in a loop to keep on reading mouse data
    Mouse.Where (x, y, button)    %code to find data on mouse
    put " ", x, " ", y     %put mouse location
    %check to see if button is hit
    if button = 1 then
        locatexy (maxx div 2, maxy div 2)
        put "you clicked the button"
        delay (1000)
        cls
    end if
    cls
end loop

-----------------------------------
Jay316
Wed Jun 22, 2005 6:54 pm


-----------------------------------
thanks so very much! im gonan try and load this program just before my test  :P
