| 
View.Set ("offscreenonly")
 var font1, font2 : int
 var x, y : int                                     %locates the x and y coords and the clicking of the mouse
 var btn : int := 0
 var picID : int := 0
 var picIDgp, picIDgp1, picIDflipgp1 : int          %the whole process to create the gamepiece
 var picIDgp2, picIDgp3, picIDflipgp2 : int
 var plyr1 : int := 0                               %player one
 var plyr2 : int := 0                               %player 2
 var click : int := 0                               %when btn is pressed
 var grid1, grid2, grid3 : int := 0
 %, f, g, h, i, j, k
 font1 := Font.New ("Verdana:10")                                 %text font is changed
 assert font1 > 0                                                 %checks if font changed
 font2 := Font.New ("BankGothic Lt BT:28")                        %text font is changed
 assert font2 > 0                                                 %checks if font changed
 %-----------------------------------------------------------------------------------
 proc ticgrid
 
 Draw.ThickLine (175, 75, 175, 375, 5, blue)                  %tic-tac toe grid
 Draw.ThickLine (275, 375, 275, 75, 5, green)                 %tic-tac toe grid
 Draw.ThickLine (75, 275, 375, 275, 5, red)                   %tic-tac toe grid
 Draw.ThickLine (75, 175, 375, 175, 5, brown)                %tic-tac toe grid
 Draw.DashedLine (75, 75, 375, 75, drawDashDotDot, brightblue) %part of outer box
 Draw.DashedLine (375, 375, 75, 375, drawDashDotDot, brightblue) %part of outer box
 Draw.DashedLine (75, 75, 75, 375, drawDashDotDot, brightblue) %part of outer box
 Draw.DashedLine (375, 375, 375, 75, drawDashDotDot, brightblue) %part of outer box
 Font.Draw ("TIC-TAC TOE ", 100, 430, font2, black)           %text font in BankGothic
 Font.Draw ("CLASSIC ", 130, 400, font2, black)               %text font in Verdana
 Font.Draw ("name: ", 410, 330, font1, black)                 %text font in Verdana
 Font.Draw ("score: ", 410, 310, font1, black)                %text font in Verdana
 Font.Draw ("name:", 410, 200, font1, black)                  %text font in Verdana
 Font.Draw ("score:", 410, 180, font1, black)                 %text font in Verdana
 Pic.Draw (picIDflipgp1, 450, 75, picMerge)
 Pic.Draw (picIDflipgp2, 450, -75, picMerge)
 
 % locate (10,40)
 % put f ..
 % locate (10,50)
 % put g ..
 % locate (10,60)
 % put h ..
 % locate (10,70)
 % put i ..
 % locate (10,80)
 % put j ..
 % locate (20,10)
 % put k ..
 end ticgrid
 proc gamepiece
 drawline (0, 10, 20, 50, red)            %... main body
 drawline (40, 10, 20, 50, red)           %... main body
 drawline (0, 10, 20, 20, red)            %... main body
 drawline (40, 10, 20, 20, red)           %... main body
 for i : 1 .. 15
 drawline (0, 10, 20, 20 + i, blue)   %... engine
 drawline (40, 10, 20, 20 + i, blue)  %... engine
 drawline (13, 35, 27, 35, green)      %... engine
 drawline (20, 20 + i, 13, 35, green) %...weapon type
 drawline (27, 34, 20, 20 + i, green) %...weapon type
 View.Update
 end for
 end gamepiece
 
 proc gamepiece2
 drawline (0, 10, 20, 50, black)            %... main body
 drawline (40, 10, 20, 50, black)           %... main body
 drawline (0, 10, 20, 20, black)            %... main body
 drawline (40, 10, 20, 20, black)           %... main body
 for i : 1 .. 15
 drawline (0, 10, 20, 20 + i, red)   %... engine
 drawline (40, 10, 20, 20 + i, red)  %... engine
 drawline (13, 35, 27, 35, blue)      %... engine
 drawline (20, 20 + i, 13, 35, blue) %...weapon type
 drawline (27, 34, 20, 20 + i, blue) %...weapon type
 View.Update
 end for
 end gamepiece2
 %------------------------------------------------------------------
 gamepiece
 % draws the character
 picIDgp := Pic.New (0, 8, 42, 50)                  % allows the character to move
 picIDgp1 := Pic.New (0, 8, 42, 221)                  % draws unaltered version of boss
 cls
 picIDflipgp1 := Pic.Flip (picIDgp1)                     % flips the  pic
 Pic.Draw (picIDflipgp1, 20, 20, picMerge)
 cls
 picIDgp1 := Pic.Scale (picIDflipgp1, 3 * 50, 3 * 150)
 
 
 gamepiece2
 picIDgp2 := Pic.New (0, 8, 42, 50)                  % allows the character to move
 picIDgp2 := Pic.New (0, 8, 42, 221)                  % draws unaltered version of boss
 cls
 picIDflipgp2 := Pic.Flip (picIDgp2)                     % flips the  pic
 Pic.Draw (picIDflipgp2, 20, 20, picMerge)
 cls
 picIDgp2 := Pic.Scale (picIDflipgp2, 3 * 50, 3 * 150)
 
 
 %-----------------------------------------------------------------------------------
 
 %plyr to click icon
 loop
 
 mousewhere (x, y, btn)
 View.Update
 cls
 ticgrid            %draws the grid
 
 % if btn = 1 then
 %     loop
 %         mousewhere (x, y, btn)
 %        locate(10,20)
 %          put x ..
 %         put y ..
 %         View.Update
 %         exit when btn = 0
 %     end loop
 % end if
 
 put btn ..       %shows if the button is pressed
 put click ..     % also shows the btn being pressed used to show the gamepiece
 
 %comand to draw the gamepiece to follow the mouse
 if x > 450 and x < 490 and y > 240 and y < 290 and btn = 1 then
 Pic.Draw (picIDflipgp1, -20 + x, -200 + y, picMerge)
 picID := picIDflipgp1
 plyr1 := 1
 click := 1
 end if
 if picID = picIDflipgp1 and click = 1 then
 Pic.Draw (picIDflipgp1, -20 + x, -200 + y, picMerge)
 click := 1
 end if
 
 %comand to draw the gamepiece to follow the mouse
 if x > 440 and x < 490 and y > 90 and y < 140 and btn = 1 then
 Pic.Draw (picIDflipgp2, -20 + x, -200 + y, picMerge)
 picID := picIDflipgp2
 plyr2 := 2
 click := 2
 end if
 if picID = picIDflipgp2 and click = 2 then
 Pic.Draw (picIDflipgp2, -20 + x, -200 + y, picMerge)
 click := 2
 end if
 
 
 
 %... the code for placement of game pieces on grid 1
 %%%%%%%%%%%%%%%%%%%%%PROBLEM AREA%%%%%%%%%%%%%%%%%%%%%%%%
 if x > 80 and x < 170 and y > 280 and y < 370 and btn = 1 and plyr1 = 1 and grid1 = 0 then
 grid1 := 1
 end if
 if x > 80 and x < 170 and y > 280 and y < 370 and btn = 1 and plyr2 = 2 and grid1 = 0 then
 grid1 := 2
 end if
 
 
 if grid1 = 1 and plyr1 = 1 then
 Pic.Draw (picIDflipgp1, 105, 130, picMerge)
 end if
 if grid1 = 2 and plyr2 = 2 then
 Pic.Draw (picIDflipgp2, 105, 130, picMerge)
 end if
 
 
 %... the code for placement of game pieces on grid 2
 if x > 180 and x < 270 and y > 280 and y < 372 and btn = 1 and plyr1 = 1 and grid2 = 0 then
 grid2 := 1
 end if
 if x > 180 and x < 270 and y > 280 and y < 372 and btn = 1 and plyr2 = 2 and grid2 = 0 then
 grid2 := 2
 end if
 if grid2 = 1 and plyr1 = 1 then
 Pic.Draw (picIDflipgp1, 205, 130, picMerge)
 end if
 if grid2 = 2 and plyr2 = 2 then
 Pic.Draw (picIDflipgp2, 205, 130, picMerge)
 end if
 
 
 %... the code for placement of game pieces on grid 3
 if x > 280 and x < 370 and y > 280 and y < 372 and btn = 1 and plyr1 = 1 and grid3 = 0 then
 grid3 := 1
 end if
 if x > 280 and x < 370 and y > 280 and y < 372 and btn = 1 and plyr2 = 2 and grid3 = 0 then
 grid3 := 2
 end if
 if grid3 = 1 and plyr1 = 1 then
 Pic.Draw (picIDflipgp1, 305, 130, picMerge)
 end if
 if grid3 = 2 and plyr2 = 2 then
 Pic.Draw (picIDflipgp2, 305, 130, picMerge)
 end if
 
 end loop
 
 |