mirror of
https://github.com/d3vyce/Python-Game.git
synced 2025-07-01 17:38:19 +02:00
start of snake movement
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
|
||||
DIRECTION = {'left': (0, -1), 'right': (0, 1), 'up': (-1, 0), 'down': (1, 0)}
|
||||
|
||||
class List:
|
||||
def __init__(self, val, next):
|
||||
self.val = val
|
||||
@ -26,3 +28,16 @@ class List:
|
||||
L = L.next
|
||||
|
||||
return i
|
||||
|
||||
def Snake_move(M, L, dir):
|
||||
L_save = L
|
||||
|
||||
L.val = (DIRECTION[dir][0] + L.val[0], DIRECTION[dir][1] + L.val[1])
|
||||
|
||||
L = L.next
|
||||
L_save = L_save.next
|
||||
|
||||
while L is not None:
|
||||
|
||||
|
||||
L = L.next
|
Reference in New Issue
Block a user