mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-02 00:00:14 -08:00
Classic TicTacToe just in Executable format
First, pick either 'X' or 'O' from the screen then, play the normal one Player TicTacToe. Playing on Terminal is kinda boring so, I made it into an executable file.
This commit is contained in:
23
89_Tic-Tac-Toe/python/TicTacToe_exe/Images.py
Normal file
23
89_Tic-Tac-Toe/python/TicTacToe_exe/Images.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import os
|
||||
import game_config as gc
|
||||
|
||||
from pygame import image, transform
|
||||
|
||||
def GetName(val):
|
||||
return str(val) + ".png"
|
||||
|
||||
class Image:
|
||||
def __init__(self, val):
|
||||
self.name = GetName(val) #names of image with .png
|
||||
self.image_path = os.path.join(gc.ASSET_DIR, self.name) #path of image from the assets file
|
||||
self.image = image.load(self.image_path) #loaded the image
|
||||
self.image = transform.scale(self.image, (gc.IMAGE_SIZE - 2 * gc.MARGIN, gc.IMAGE_SIZE - 2 * gc.MARGIN)) #fixed image as per req.
|
||||
# self.box = self.image.copy() # box
|
||||
#self.box.fill((200, 200, 200))
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for i in gc.ASSET_FILES:
|
||||
temp = Image(i)
|
||||
print(temp.name,temp.image_path,temp.image,temp)
|
||||
Reference in New Issue
Block a user