Compare commits
No commits in common. "2ef0664c481519d79916e44ec4c10473147acc36" and "c9d5b8684c46cb55f063f63758fad53462ea94fd" have entirely different histories.
2ef0664c48
...
c9d5b8684c
Binary file not shown.
Before Width: | Height: | Size: 63 KiB |
46
main.py
46
main.py
@ -1,40 +1,16 @@
|
|||||||
import pygame
|
# This is a sample Python script.
|
||||||
|
|
||||||
pygame.init()
|
# Press ⌃R to execute it or replace it with your code.
|
||||||
|
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
|
||||||
CUBE_SIZE = 128
|
|
||||||
NUM_X = 8
|
|
||||||
NUM_Y = 4
|
|
||||||
WIDTH = 1024
|
|
||||||
HEIGHT = 512
|
|
||||||
screen = pygame.display.set_mode((WIDTH, HEIGHT))
|
|
||||||
WHITE = (255, 255, 255)
|
|
||||||
screen.fill(WHITE)
|
|
||||||
pygame.display.update()
|
|
||||||
BLACK = (0, 0, 0)
|
|
||||||
BROWN = (139, 69, 19)
|
|
||||||
|
|
||||||
def draw_grid():
|
|
||||||
for x in range(NUM_X):
|
|
||||||
for y in range(NUM_Y):
|
|
||||||
pygame.draw.rect(screen, BROWN, (x * CUBE_SIZE, y * CUBE_SIZE, CUBE_SIZE, CUBE_SIZE))
|
|
||||||
|
|
||||||
for x in range(0, WIDTH, CUBE_SIZE):
|
|
||||||
pygame.draw.line(screen, BLACK, (x, 0), (x, HEIGHT))
|
|
||||||
for y in range(0, HEIGHT, CUBE_SIZE):
|
|
||||||
pygame.draw.line(screen, BLACK, (0, y), (WIDTH, y))
|
|
||||||
|
|
||||||
# Draw tractor
|
|
||||||
tractor_image = pygame.image.load('images/traktor.png')
|
|
||||||
tractor_image = pygame.transform.scale(tractor_image, (CUBE_SIZE, CUBE_SIZE))
|
|
||||||
screen.blit(tractor_image, (CUBE_SIZE - 128, CUBE_SIZE - 128))
|
|
||||||
|
|
||||||
|
|
||||||
while True:
|
def print_hi(name):
|
||||||
for event in pygame.event.get():
|
# Use a breakpoint in the code line below to debug your script.
|
||||||
if event.type == pygame.QUIT:
|
print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint.
|
||||||
quit()
|
|
||||||
|
|
||||||
draw_grid()
|
|
||||||
|
|
||||||
pygame.display.update()
|
# Press the green button in the gutter to run the script.
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print_hi('AI Team')
|
||||||
|
|
||||||
|
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
||||||
|
Loading…
Reference in New Issue
Block a user