moved the tractor drawing code to the Tractor class
This commit is contained in:
parent
aa9519bc0f
commit
1f08e350d8
@ -2,11 +2,11 @@
|
|||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
from area.constants import WIDTH,HEIGHT,FIELD_WIDTH,FIELD_HEIGHT,TILE_SIZE,GREY,ROWS,COLS
|
from area.constants import WIDTH,HEIGHT,FIELD_WIDTH,FIELD_HEIGHT,TILE_SIZE,GREY,ROWS,COLS
|
||||||
from area.tractor import Tractor
|
|
||||||
from tile import Tile
|
from tile import Tile
|
||||||
|
|
||||||
tiles = []
|
tiles = []
|
||||||
tractor = Tractor(0*TILE_SIZE, 0*TILE_SIZE)
|
|
||||||
|
|
||||||
fieldX = (WIDTH-FIELD_WIDTH)/2
|
fieldX = (WIDTH-FIELD_WIDTH)/2
|
||||||
# in center of the screen
|
# in center of the screen
|
||||||
fieldY = 100
|
fieldY = 100
|
||||||
@ -17,8 +17,7 @@ def positionFieldElements():
|
|||||||
for t in tiles:
|
for t in tiles:
|
||||||
t.x += fieldX
|
t.x += fieldX
|
||||||
t.y += fieldY
|
t.y += fieldY
|
||||||
tractor.x += fieldX
|
|
||||||
tractor.y += fieldY
|
|
||||||
|
|
||||||
def createTiles():
|
def createTiles():
|
||||||
for y in range(0, COLS):
|
for y in range(0, COLS):
|
||||||
@ -35,11 +34,10 @@ def createField(win):
|
|||||||
image = pygame.transform.scale(image, (TILE_SIZE, TILE_SIZE))
|
image = pygame.transform.scale(image, (TILE_SIZE, TILE_SIZE))
|
||||||
win.blit(image, (t.x, t.y))
|
win.blit(image, (t.x, t.y))
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
imageTractor = pygame.image.load(tractor.image).convert_alpha()
|
|
||||||
imageTractor = pygame.transform.scale(imageTractor, (TILE_SIZE, TILE_SIZE))
|
|
||||||
win.blit(imageTractor, (tractor.x, tractor.y))
|
|
||||||
pygame.display.flip()
|
|
||||||
|
|
||||||
def drawWindow(win):
|
def drawWindow(win):
|
||||||
win.fill(GREY)
|
win.fill(GREY)
|
||||||
createField(win)
|
createField(win)
|
||||||
|
pygame.display.flip()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user