Compare commits
2 Commits
ae5614369f
...
517b60b7a7
Author | SHA1 | Date | |
---|---|---|---|
517b60b7a7 | |||
98cccf5848 |
18
main.py
18
main.py
@ -5,6 +5,14 @@ pygame.init()
|
|||||||
screen = pygame.display.set_mode((1280, 720))
|
screen = pygame.display.set_mode((1280, 720))
|
||||||
c = (0, 150, 0)
|
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)
|
||||||
|
|
||||||
|
|
||||||
class Wozek:
|
class Wozek:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.x = 55
|
self.x = 55
|
||||||
@ -40,17 +48,11 @@ def main():
|
|||||||
if wozek.x >= 100:
|
if wozek.x >= 100:
|
||||||
wozek.x -= 80
|
wozek.x -= 80
|
||||||
|
|
||||||
|
|
||||||
for x in range(0, 1280, 80):
|
|
||||||
pygame.draw.line(screen, c, (1, x), (1280, x), 2)
|
|
||||||
pygame.draw.line(screen, c, (x, 1), (x, 720), 2)
|
|
||||||
pygame.display.update()
|
|
||||||
|
|
||||||
|
|
||||||
# Drawing
|
# Drawing
|
||||||
screen.fill((0, 0, 0)) # removes object trail
|
screen.fill((0, 0, 0)) # removes object trail
|
||||||
pygame.display.flip() #updating frames
|
draw_grid()
|
||||||
wozek.draw()
|
wozek.draw()
|
||||||
|
pygame.display.flip() # updating frames
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user