fixing size of the grid to 10x10
This commit is contained in:
parent
517b60b7a7
commit
c4d21146a9
14
main.py
14
main.py
@ -2,15 +2,15 @@ import pygame
|
||||
import sys
|
||||
|
||||
pygame.init()
|
||||
screen = pygame.display.set_mode((1280, 720))
|
||||
screen = pygame.display.set_mode((980, 980))
|
||||
c = (0, 150, 0)
|
||||
|
||||
|
||||
def draw_grid():
|
||||
for y in range(80, 720, 80): # horizontal lines
|
||||
pygame.draw.line(screen, c, (80, y), (1280 - 80, y), 1)
|
||||
for x in range(80, 1280, 80): # vertical lines
|
||||
pygame.draw.line(screen, c, (x, 80), (x, 720 - 80), 1)
|
||||
for y in range(80, 960, 80): # horizontal lines
|
||||
pygame.draw.line(screen, c, (80, y), (960 - 80, y), 1)
|
||||
for x in range(80, 960, 80): # vertical lines
|
||||
pygame.draw.line(screen, c, (x, 80), (x, 960 - 80), 1)
|
||||
|
||||
|
||||
class Wozek:
|
||||
@ -36,13 +36,13 @@ def main():
|
||||
elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
|
||||
sys.exit(0)
|
||||
elif event.type == pygame.KEYDOWN and event.key == pygame.K_DOWN:
|
||||
if wozek.y <= 600:
|
||||
if wozek.y <= 800:
|
||||
wozek.y += 80
|
||||
elif event.type == pygame.KEYDOWN and event.key == pygame.K_UP:
|
||||
if wozek.y >= 100:
|
||||
wozek.y -= 80
|
||||
elif event.type == pygame.KEYDOWN and event.key == pygame.K_RIGHT:
|
||||
if wozek.x <= 1170:
|
||||
if wozek.x <= 800:
|
||||
wozek.x += 80
|
||||
elif event.type == pygame.KEYDOWN and event.key == pygame.K_LEFT:
|
||||
if wozek.x >= 100:
|
||||
|
Loading…
Reference in New Issue
Block a user