11/5/2022 0 Comments X and o png![]() ![]() ![]() The height and width of the canvas where we will play the game is 400×400. Here, the TTT is the main 3×3 Tic Tac Toe board and at first, it will have 9 None values. Then we initialize all the global variables that we will use in our Tic Tac Toe game. So let’s start by importing the pygame library and the time library because we will use the time.sleep() method to pause game at certain positions. So that is basically what we will do in this Python project idea. Then we will draw the appropriate ‘X’ or ‘O’ image on the canvas. Then we will check which square the user has clicked. It will continuously look for events and when a user presses the mouse button on the grid we will first get the X and Y coordinates of the mouse. We need to run our game inside an infinite loop.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |