33 lines
1007 B
Python
33 lines
1007 B
Python
import copy
|
|
import pygame
|
|
|
|
class MeinSpiel:
|
|
bilder = ["Bilder/Grass.jpg","Bilder/Hase.jpg","Bilder/m.webp","Bilder/blue.jpg","Bilder/Mensch.webp"]
|
|
spielfeld = []
|
|
|
|
def __init__(self, felderX, felderY):
|
|
for x in range(felderX):
|
|
self.spielfeld.append([])
|
|
for y in range(felderY):
|
|
self.spielfeld[x].append(3)
|
|
|
|
def anfangsKonfiguration(self):
|
|
self.spielfeld[6][2] = 2
|
|
self.spielfeld[3][1] = 4
|
|
|
|
|
|
def tasteGedrueckt(self, taste):
|
|
if pygame.K_UP == taste:
|
|
print("UP")
|
|
self.spielfeld[12][12] = 2
|
|
if pygame.K_DOWN == taste:
|
|
print("DOWN")
|
|
self.spielfeld[12][13] = 2
|
|
if pygame.K_LEFT == taste:
|
|
for x in range(len(self.spielfeld)):
|
|
for y in range(len(self.spielfeld[x])):
|
|
if self.spielfeld[x][y] == 1:
|
|
self.spielfeld[x][y-1] = 1
|
|
self.spielfeld[x][y] = 0
|
|
|