-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass.py
47 lines (33 loc) · 892 Bytes
/
class.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
39
40
41
42
43
44
45
46
47
# Creating a basic Snake Game
import pygame
# Drawing the Grid
from pygame.examples.video import *
def drawGrid(w, rows, surface):
sizeBetween = width // rows
x = 0
y = 0
for l in range(rows):
x = x + sizeBetween
y = y + sizeBetween
pygame.draw.line(surface, (255, 255, 255), (x, 0), (x, w))
pygame.draw.line(surface, (255, 255, 255), (0, y), (w, y))
# The Redraw Function
def redrawWindow(surface):
global rows, width
win.fill((0, 0, 0))
drawGrid(width, rows, surface)
pygame.display.update()
# The main Window
def snake():
pass
def main():
global width, rows
width = 500
rows = 20
win = pygame.display.set_mode((width, width))
s = snake((255, 0, 0), (10, 10))
clock = pygame.time.clock()
while(1):
pygame.time.delay(50)
clock.tick(10)
redrawWindow(win)