SterowanieManualnePrzeniesione
This commit is contained in:
parent
ac55e5bf57
commit
55171b73f9
@ -29,7 +29,7 @@ TRACTOR_WIDTH = TILE_SIZE
|
||||
TRACTOR_HEIGHT = TILE_SIZE
|
||||
|
||||
#FRAMES PER SECOND
|
||||
FPS = 1
|
||||
FPS = 10
|
||||
|
||||
#ANIMATION_PART
|
||||
|
||||
|
2
main.py
2
main.py
@ -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)
|
||||
|
@ -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"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user