SIP/main.py
2021-03-24 00:20:41 +01:00

71 lines
1.9 KiB
Python

import pygame
from container.constans import WIDTH, HEIGHT, ROWS, COLUMNS, GREEN
from container.board import Board
FPS = 8
#creating game window
WIN = pygame.display.set_mode((WIDTH,HEIGHT))
#setting name
pygame.display.set_caption('Forest')
pygame.font.init()
#detective = pygame.image.load(r'container\detective.png')
def main():
run = True
clock = pygame.time.Clock() #for fps
board = Board(0,40,WIDTH,HEIGHT-40)
#board.manage_rows_and_col(ROWS,COLUMNS)
#managing agent location
#current_column = 0
#current_row = 0
#current_piece = board.get_piece(current_row,current_column)
#current_piece.change_status()
#calculate desireable location to pixels
def claculate_position(x,y):
x = SQUARE_SIZE * x
y = SQUARE_SIZE * y
return [x,y]
while run:
clock.tick(FPS)
#print(current_column,current_row)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
#managing arrow click
key_input = pygame.key.get_pressed()
if key_input[pygame.K_LEFT]: board.move(0,-1)
if key_input[pygame.K_UP]: board.move(-1,0)
if key_input[pygame.K_RIGHT]: board.move(0,1)
if key_input[pygame.K_DOWN]: board.move(1,0)
"""
#managing agent location
current_piece.change_status()
current_piece = board.get_piece(current_row,current_column)
current_piece.change_status()
"""
#drawing map and detective
WIN.fill(GREEN)
board.draw_squares(WIN)
board.draw_pieces(WIN)
board.draw_agent(WIN)
board.draw_info(WIN)
#WIN.blit(detective, (claculate_position(current_column,current_row)[0], claculate_position(current_column,current_row)[1]))
pygame.display.update()
pygame.quit()
main()