poprawki
This commit is contained in:
parent
df8dd868e7
commit
bbc9deb5f9
20
main.py
20
main.py
@ -26,10 +26,9 @@ exclamation_image = pygame.transform.scale(exclamation_image, (GRID_SIZE,GRID_SI
|
|||||||
an1 = Elephant(10, 2)
|
an1 = Elephant(10, 2)
|
||||||
an2 = Elephant(12, 2)
|
an2 = Elephant(12, 2)
|
||||||
an3 = Elephant(14, 7)
|
an3 = Elephant(14, 7)
|
||||||
|
|
||||||
old_an1 = Elephant(3, 6, adult=True)
|
old_an1 = Elephant(3, 6, adult=True)
|
||||||
|
|
||||||
Elephants = [an1, an2, an3,old_an1]
|
Animals = [an1, an2, an3,old_an1]
|
||||||
|
|
||||||
def draw_grid():
|
def draw_grid():
|
||||||
for y in range(0, GRID_HEIGHT * GRID_SIZE, GRID_SIZE):
|
for y in range(0, GRID_HEIGHT * GRID_SIZE, GRID_SIZE):
|
||||||
@ -40,11 +39,11 @@ def draw_grid():
|
|||||||
def draw_exclamation(x, y):
|
def draw_exclamation(x, y):
|
||||||
screen.blit(exclamation_image, (x*GRID_SIZE, y*GRID_SIZE - GRID_SIZE))
|
screen.blit(exclamation_image, (x*GRID_SIZE, y*GRID_SIZE - GRID_SIZE))
|
||||||
|
|
||||||
def draw_Elephants():
|
def draw_Animals():
|
||||||
for Elephant in Elephants:
|
for Animal in Animals:
|
||||||
Elephant.draw(screen, GRID_SIZE)
|
Animal.draw(screen, GRID_SIZE)
|
||||||
if Elephant.feed() == 'True':
|
if Animal.feed() == 'True':
|
||||||
draw_exclamation(Elephant.x, Elephant.y)
|
draw_exclamation(Animal.x, Animal.y)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -57,14 +56,13 @@ def main():
|
|||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
pygame.quit()
|
pygame.quit()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
agent.handle_event(event,GRID_HEIGHT,GRID_WIDTH,Elephants)
|
agent.handle_event(event,GRID_HEIGHT,GRID_WIDTH,Animals)
|
||||||
|
|
||||||
for Elephant in Elephants:
|
|
||||||
Elephant.getting_hungry()
|
|
||||||
|
|
||||||
screen.blit(background_image,(0,0))
|
screen.blit(background_image,(0,0))
|
||||||
draw_grid()
|
draw_grid()
|
||||||
draw_Elephants()
|
draw_Animals()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user