Computer Science Canada tic-tac-toe |
Author: | gta_master1987 [ Sat Jun 05, 2004 7:22 pm ] |
Post subject: | tic-tac-toe |
i have trouble drawing x and o on my board here is my board: colourback (black) cls drawbox (23, 122, 282, 382, white) drawline (111, 123, 111, 381, white) drawline (196, 123, 196, 381, white) drawline (24, 211, 281, 211, white) drawline (24, 301, 281, 301, white) how can i draw x and o on this board? |
Author: | Delos [ Sat Jun 05, 2004 8:10 pm ] | ||
Post subject: | |||
1) Use [ code] tags. 2) Drawing commands can be used here. Eg.
In case you need to know, the syntax is: drawline (startX, startY, endX, endY, colourRef) drawoval (centreX, centreY, Xradius, yRadius, colourRef) |
Author: | Cervantes [ Sat Jun 05, 2004 8:10 pm ] |
Post subject: | |
what have you tried so far?? maybe you could use Font.New to create a font, and Font.Draw or Draw.Text to draw an "x" or an "o" onto the board. |
Author: | gta_master1987 [ Sun Jun 06, 2004 12:26 am ] |
Post subject: | |
i can draw the x and o but i can's place it one the board |
Author: | Cervantes [ Sun Jun 06, 2004 7:36 am ] |
Post subject: | |
you can. its just difficult because of the placement of the board. It would be best if you had a constant for the width and the height of the grid, in pixels, called gridsize or something. then you can figure out everything by looking at what square it is in ((1,1), (2,3) etc.). then whenever you want to draw something you multiply the grid position by the gridsize. |
Author: | bryan_magnum [ Thu Jun 10, 2004 10:00 pm ] | ||
Post subject: | |||
Im tired now so this isnt much. This just draws an X and an O anywhere if you right or left click
|