-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain3.py
39 lines (27 loc) · 844 Bytes
/
main3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pygame
from battleship.constants import WIDTH, HEIGHT, SEPARATION, SQUARE_SIZE
from battleship.board import Board
from battleship.cells import Cell
from battleship.user import User
from battleship.ai import OpponentAI
from battleship.game import Game
FPS = 60
# Creates and names a new Window
WIN = pygame.display.set_mode((2*WIDTH + SEPARATION, HEIGHT))
pygame.display.set_caption('Battleship')
def get_coords(pos):
x, y = pos
row = x // SQUARE_SIZE
col = y // SQUARE_SIZE
coords = ((row, col),)
return coords
# Manages and launches the game loop (if it breaks one of the conditions the loop ends)
def main():
run = True
game1 = Game(WIN)
clock = pygame.time.Clock() # Sets the fps to 60
while run:
clock.tick(FPS)
game1.Put_boats_stage()
pygame.quit()
main()