SterowanieManualnePrzeniesione

This commit is contained in:
secret_dude 2021-04-13 18:48:24 +02:00
parent ac55e5bf57
commit 55171b73f9
3 changed files with 7 additions and 9 deletions

View File

@ -29,7 +29,7 @@ TRACTOR_WIDTH = TILE_SIZE
TRACTOR_HEIGHT = TILE_SIZE
#FRAMES PER SECOND
FPS = 1
FPS = 10
#ANIMATION_PART

View File

@ -50,8 +50,6 @@ while working:
if tractor.engineWorking:
tractor.reduce_fuel()
tractor.drive()
drawUI.drawUI(board, display, tractor, tractor.direction, tillageUnit, field, animationSpeed)
clock.tick(FPS)

View File

@ -1,8 +1,8 @@
import driving
from constants import *
from TractorAction import action
import pygame
def manualSteeringDriver(event, board, tractor, hitchCounter, tillageUnit, loadCounter, animationSpeed):
if event.key == pygame.K_SPACE:
field = board[tractor.horizontal_index][tractor.vertical_index]
@ -30,6 +30,10 @@ def manualSteeringDriver(event, board, tractor, hitchCounter, tillageUnit, loadC
tillageUnit.load = "Water"
elif loadCounter == 3:
tillageUnit.load = "Fertilizer"
if event.key == pygame.K_SPACE:
tractor.drive()
if event.key == pygame.K_r:
if tractor.engineWorking:
tractor.turnOffEngine()
@ -49,6 +53,7 @@ def manualSteeringDriver(event, board, tractor, hitchCounter, tillageUnit, loadC
manualTurning(event, tractor)
return hitchCounter, loadCounter, animationSpeed
def manualTurning(event, tractor):
tractor.direction = "STOP"
if event.type == pygame.KEYDOWN:
@ -60,8 +65,3 @@ def manualTurning(event, tractor):
tractor.direction = "UP"
elif event.key == pygame.K_DOWN and tractor.vertical_index < VERTICAL_TILES_NUMBER - 1:
tractor.direction = "DOWN"