dodano buraki, marchewki, ziemniaki
@ -5,7 +5,9 @@
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/definitions.py" beforeDir="false" afterPath="$PROJECT_DIR$/definitions.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/py.py" beforeDir="false" afterPath="$PROJECT_DIR$/py.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/soil.py" beforeDir="false" afterPath="$PROJECT_DIR$/soil.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/potatoes_stage1.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/potatoes_stage1.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/potatoes_stage2.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/potatoes_stage2.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/potatoes_stage3.png" beforeDir="false" afterPath="$PROJECT_DIR$/resources/potatoes_stage3.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/tractor.py" beforeDir="false" afterPath="$PROJECT_DIR$/tractor.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -93,6 +95,7 @@
|
||||
<workItem from="1617101776539" duration="127000" />
|
||||
<workItem from="1617179845457" duration="82000" />
|
||||
<workItem from="1617183365349" duration="4399000" />
|
||||
<workItem from="1617188855897" duration="3185000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -100,22 +103,22 @@
|
||||
<option name="version" value="1" />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.bottom" timestamp="1617188117951">
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.bottom" timestamp="1617192068909">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1617188117951" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.center" timestamp="1617188117951">
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1617192068909" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.center" timestamp="1617192068909">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.center/0.0.1920.1080@0.0.1920.1080" timestamp="1617188117951" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.left" timestamp="1617188117951">
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.center/0.0.1920.1080@0.0.1920.1080" timestamp="1617192068909" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.left" timestamp="1617192068909">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.left/0.0.1920.1080@0.0.1920.1080" timestamp="1617188117951" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.right" timestamp="1617188117951">
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.left/0.0.1920.1080@0.0.1920.1080" timestamp="1617192068909" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.right" timestamp="1617192068909">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.right/0.0.1920.1080@0.0.1920.1080" timestamp="1617188117951" />
|
||||
<state width="1879" height="295" key="GridCell.Tab.0.right/0.0.1920.1080@0.0.1920.1080" timestamp="1617192068909" />
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.bottom" timestamp="1616326478876">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
@ -132,12 +135,12 @@
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state width="1879" height="364" key="GridCell.Tab.1.right/0.0.1920.1080@0.0.1920.1080" timestamp="1616326478875" />
|
||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog" timestamp="1617183372447">
|
||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog" timestamp="1617188855826">
|
||||
<screen x="0" y="0" width="1920" height="1080" />
|
||||
</state>
|
||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1617183372447" />
|
||||
<state x="0" y="0" key="com.intellij.ide.util.TipDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1617188855826" />
|
||||
</component>
|
||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
||||
<SUITE FILE_PATH="coverage/SmartTractor$py.coverage" NAME="py Coverage Results" MODIFIED="1617188104059" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
<SUITE FILE_PATH="coverage/SmartTractor$py.coverage" NAME="py Coverage Results" MODIFIED="1617191945730" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
||||
</component>
|
||||
</project>
|
@ -1,6 +1,8 @@
|
||||
import os
|
||||
import pygame
|
||||
BLOCK_SIZE = 100
|
||||
BEETROOTS_GROW_TIME = 5
|
||||
BEETROOTS_MAXIMUM_STATE = 16
|
||||
BEETROOTSTAGE1 = pygame.image.load(os.path.join('resources', 'beetroots_stage1.png'))
|
||||
BEETROOTSTAGE1 = pygame.transform.scale(BEETROOTSTAGE1, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
BEETROOTSTAGE2 = pygame.image.load(os.path.join('resources', 'beetroots_stage2.png'))
|
||||
@ -9,6 +11,8 @@ BEETROOTSTAGE3 = pygame.image.load(os.path.join('resources', 'beetroots_stage3.p
|
||||
BEETROOTSTAGE3 = pygame.transform.scale(BEETROOTSTAGE3, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
BEETROOTSTAGE4 = pygame.image.load(os.path.join('resources', 'beetroots_stage4.png'))
|
||||
BEETROOTSTAGE4 = pygame.transform.scale(BEETROOTSTAGE4, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
CARROTS_GROW_TIME = 5
|
||||
CARROTS_MAXIMUM_STATE = 16
|
||||
CARROTSTAGE1 = pygame.image.load(os.path.join('resources', 'carrots_stage1.png'))
|
||||
CARROTSTAGE1 = pygame.transform.scale(CARROTSTAGE1, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
CARROTSTAGE2 = pygame.image.load(os.path.join('resources', 'carrots_stage2.png'))
|
||||
@ -24,12 +28,16 @@ FARMLAND = pygame.transform.scale(FARMLAND, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
FARMLANDMOIST = pygame.image.load(os.path.join('resources', 'farmland_moist.png'))
|
||||
FARMLANDMOIST = pygame.transform.scale(FARMLANDMOIST, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
FPS = 1
|
||||
POTATOES_GROW_TIME = 5
|
||||
POTATOES_MAXIMUM_STATE = 16
|
||||
POTATOSTAGE1 = pygame.image.load(os.path.join('resources', 'potatoes_stage1.png'))
|
||||
POTATOSTAGE1 = pygame.transform.scale(POTATOSTAGE1, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
POTATOSTAGE2 = pygame.image.load(os.path.join('resources', 'potatoes_stage2.png'))
|
||||
POTATOSTAGE2 = pygame.transform.scale(POTATOSTAGE2, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
POTATOSTAGE3 = pygame.image.load(os.path.join('resources', 'potatoes_stage3.png'))
|
||||
POTATOSTAGE3 = pygame.transform.scale(POTATOSTAGE3, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
POTATOSTAGE4 = pygame.image.load(os.path.join('resources', 'potatoes_stage4.png'))
|
||||
POTATOSTAGE4 = pygame.transform.scale(POTATOSTAGE4, (BLOCK_SIZE, BLOCK_SIZE))
|
||||
WIDTH, HEIGHT = 1000, 1000
|
||||
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
|
||||
TRACTOR = pygame.image.load(os.path.join('resources', 'tractor.png'))
|
||||
|
112
py.py
@ -13,7 +13,7 @@ def create_base_map():
|
||||
for j in range(10):
|
||||
temp_rect = pygame.Rect(i * definitions.BLOCK_SIZE, j * definitions.BLOCK_SIZE, definitions.BLOCK_SIZE, definitions.BLOCK_SIZE)
|
||||
temp_soil = soil.Soil(False, False, False)
|
||||
temp_plant = plant.Plant("wheat", 0)
|
||||
temp_plant = plant.Plant("none", 0)
|
||||
temp_field = field.Field(temp_plant, temp_rect, temp_soil)
|
||||
temp_map_field.append(temp_field)
|
||||
fields.append(temp_map_field)
|
||||
@ -22,7 +22,31 @@ def fill_map():
|
||||
for j in range(10):
|
||||
field = fields[i][j]
|
||||
rect = field.get_rect()
|
||||
if field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 0 and field.get_plant().get_state() <= 1 * definitions.WHEAT_GROW_TIME:
|
||||
if field.get_plant().get_name() == "beetroot" and field.get_plant().get_state() > 0 and field.get_plant().get_state() <= 1 * definitions.BEETROOTS_GROW_TIME:
|
||||
block = definitions.BEETROOTSTAGE1
|
||||
elif field.get_plant().get_name() == "beetroot" and field.get_plant().get_state() > 1 * definitions.BEETROOTS_GROW_TIME and field.get_plant().get_state() <= 2 * definitions.BEETROOTS_GROW_TIME:
|
||||
block = definitions.BEETROOTSTAGE2
|
||||
elif field.get_plant().get_name() == "beetroot" and field.get_plant().get_state() > 2 * definitions.BEETROOTS_GROW_TIME and field.get_plant().get_state() <= 3 * definitions.BEETROOTS_GROW_TIME:
|
||||
block = definitions.BEETROOTSTAGE3
|
||||
elif field.get_plant().get_name() == "beetroot" and field.get_plant().get_state() == 3 *definitions.BEETROOTS_GROW_TIME + 1:
|
||||
block = definitions.BEETROOTSTAGE4
|
||||
elif field.get_plant().get_name() == "carrot" and field.get_plant().get_state() > 0 and field.get_plant().get_state() <= 1 * definitions.CARROTS_GROW_TIME:
|
||||
block = definitions.CARROTSTAGE1
|
||||
elif field.get_plant().get_name() == "carrot" and field.get_plant().get_state() > 1 * definitions.CARROTS_GROW_TIME and field.get_plant().get_state() <= 2 * definitions.CARROTS_GROW_TIME:
|
||||
block = definitions.CARROTSTAGE2
|
||||
elif field.get_plant().get_name() == "carrot" and field.get_plant().get_state() > 2 * definitions.CARROTS_GROW_TIME and field.get_plant().get_state() <= 3 * definitions.CARROTS_GROW_TIME:
|
||||
block = definitions.CARROTSTAGE3
|
||||
elif field.get_plant().get_name() == "carrot" and field.get_plant().get_state() == 3 *definitions.CARROTS_GROW_TIME + 1:
|
||||
block = definitions.CARROTSTAGE4
|
||||
elif field.get_plant().get_name() == "potato" and field.get_plant().get_state() > 0 and field.get_plant().get_state() <= 1 * definitions.POTATOES_GROW_TIME:
|
||||
block = definitions.POTATOSTAGE1
|
||||
elif field.get_plant().get_name() == "potato" and field.get_plant().get_state() > 1 * definitions.POTATOES_GROW_TIME and field.get_plant().get_state() <= 2 * definitions.POTATOES_GROW_TIME:
|
||||
block = definitions.POTATOSTAGE2
|
||||
elif field.get_plant().get_name() == "potato" and field.get_plant().get_state() > 2 * definitions.POTATOES_GROW_TIME and field.get_plant().get_state() <= 3 * definitions.POTATOES_GROW_TIME:
|
||||
block = definitions.POTATOSTAGE3
|
||||
elif field.get_plant().get_name() == "potato" and field.get_plant().get_state() == 3 *definitions.POTATOES_GROW_TIME + 1:
|
||||
block = definitions.POTATOSTAGE4
|
||||
elif field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 0 and field.get_plant().get_state() <= 1 * definitions.WHEAT_GROW_TIME:
|
||||
block = definitions.WHEATSTAGE1
|
||||
elif field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 1 * definitions.WHEAT_GROW_TIME and field.get_plant().get_state() <= 2 * definitions.WHEAT_GROW_TIME:
|
||||
block = definitions.WHEATSTAGE2
|
||||
@ -40,6 +64,9 @@ def fill_map():
|
||||
block = definitions.FARMLANDMOIST
|
||||
definitions.WIN.blit(block, (rect.x, rect.y))
|
||||
def do_work(tractor1, tractor1_rect):
|
||||
loop = True
|
||||
if tractor1.get_all_amount_of_seeds() == 0:
|
||||
loop = False
|
||||
x = int(tractor1_rect.x/100)
|
||||
y = int(tractor1_rect.y/100)
|
||||
field = fields[x][y]
|
||||
@ -48,14 +75,63 @@ def do_work(tractor1, tractor1_rect):
|
||||
elif field.get_soil().get_state() is True and field.get_soil().get_water_level() is False and tractor1.get_water_level() > 0:
|
||||
tractor1.set_water_level(tractor1.get_water_level() - 1)
|
||||
field.get_soil().set_water_level(True)
|
||||
elif field.get_soil().get_state() is True and field.get_soil().get_water_level() is True and field.get_plant().get_state() == 0 and tractor1.get_amount_of_seeds("wheat") > 0:
|
||||
tractor1.set_amount_of_seeds("wheat", tractor1.get_amount_of_seeds("wheat") - 1)
|
||||
field.get_plant().set_name("wheat")
|
||||
field.get_plant().set_state(1)
|
||||
elif field.get_soil().get_state() is True and field.get_soil().get_water_level() is True and field.get_plant().get_state() == 0:
|
||||
while loop is True:
|
||||
random1 = random.randint(1, 4)
|
||||
if random1 == 1 and tractor1.get_amount_of_seeds("beetroot") > 0:
|
||||
tractor1.set_amount_of_seeds("beetroot", tractor1.get_amount_of_seeds("beetroot") - 1)
|
||||
field.get_plant().set_name("beetroot")
|
||||
field.get_plant().set_state(1)
|
||||
loop = False
|
||||
elif random1 == 2 and tractor1.get_amount_of_seeds("carrot") > 0:
|
||||
tractor1.set_amount_of_seeds("carrot", tractor1.get_amount_of_seeds("carrot") - 1)
|
||||
field.get_plant().set_name("carrot")
|
||||
field.get_plant().set_state(1)
|
||||
loop = False
|
||||
elif random1 == 3 and tractor1.get_amount_of_seeds("potato") > 0:
|
||||
tractor1.set_amount_of_seeds("potato", tractor1.get_amount_of_seeds("potato") - 1)
|
||||
field.get_plant().set_name("potato")
|
||||
field.get_plant().set_state(1)
|
||||
loop = False
|
||||
elif random1 == 4 and tractor1.get_amount_of_seeds("wheat") > 0:
|
||||
tractor1.set_amount_of_seeds("wheat", tractor1.get_amount_of_seeds("wheat") - 1)
|
||||
field.get_plant().set_name("wheat")
|
||||
field.get_plant().set_state(1)
|
||||
loop = False
|
||||
elif field.get_plant().get_name() == "beetroot" and field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.BEETROOTS_MAXIMUM_STATE - definitions.BEETROOTS_GROW_TIME and tractor1.get_fertilizer("beetroot") > 0 and field.get_soil().get_is_fertilized() is False:
|
||||
tractor1.set_fertilizer("beetroot", (tractor1.get_fertilizer("beetroot") - 1))
|
||||
field.get_soil().set_is_fertilized(True)
|
||||
field.get_plant().set_state(field.get_plant().get_state() + definitions.BEETROOTS_GROW_TIME)
|
||||
elif field.get_plant().get_name() == "carrot" and field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.CARROTS_MAXIMUM_STATE - definitions.CARROTS_GROW_TIME and tractor1.get_fertilizer("carrot") > 0 and field.get_soil().get_is_fertilized() is False:
|
||||
tractor1.set_fertilizer("carrot", (tractor1.get_fertilizer("carrot") - 1))
|
||||
field.get_soil().set_is_fertilized(True)
|
||||
field.get_plant().set_state(field.get_plant().get_state() + definitions.CARROTS_GROW_TIME)
|
||||
elif field.get_plant().get_name() == "potato" and field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.POTATOES_MAXIMUM_STATE - definitions.POTATOES_GROW_TIME and tractor1.get_fertilizer("potato") > 0 and field.get_soil().get_is_fertilized() is False:
|
||||
tractor1.set_fertilizer("potato", (tractor1.get_fertilizer("potato") - 1))
|
||||
field.get_soil().set_is_fertilized(True)
|
||||
field.get_plant().set_state(field.get_plant().get_state() + definitions.POTATOES_GROW_TIME)
|
||||
elif field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.WHEAT_MAXIMUM_STATE - definitions.WHEAT_GROW_TIME and tractor1.get_fertilizer("wheat") > 0 and field.get_soil().get_is_fertilized() is False:
|
||||
tractor1.set_fertilizer("wheat", (tractor1.get_fertilizer("wheat") - 1))
|
||||
field.get_soil().set_is_fertilized(True)
|
||||
field.get_plant().set_state(field.get_plant().get_state() + definitions.WHEAT_GROW_TIME)
|
||||
elif field.get_plant().get_name() == "beetroot" and field.get_plant().get_state() == definitions.BEETROOTS_MAXIMUM_STATE and tractor1.get_all_collected_plants() < definitions.TRACTOR_MAXIMUM_COLLECTED_PLANTS:
|
||||
field.get_plant().set_state(0)
|
||||
field.get_soil().set_is_fertilized(False)
|
||||
field.get_soil().set_water_level(False)
|
||||
field.get_soil().set_state(False)
|
||||
tractor1.set_collected_plants("beetroot", tractor1.get_collected_plants("beetroot") + 1)
|
||||
elif field.get_plant().get_name() == "carrot" and field.get_plant().get_state() == definitions.CARROTS_MAXIMUM_STATE and tractor1.get_all_collected_plants() < definitions.TRACTOR_MAXIMUM_COLLECTED_PLANTS:
|
||||
field.get_plant().set_state(0)
|
||||
field.get_soil().set_is_fertilized(False)
|
||||
field.get_soil().set_water_level(False)
|
||||
field.get_soil().set_state(False)
|
||||
tractor1.set_collected_plants("carrot", tractor1.get_collected_plants("carrot") + 1)
|
||||
elif field.get_plant().get_name() == "potato" and field.get_plant().get_state() == definitions.POTATOES_MAXIMUM_STATE and tractor1.get_all_collected_plants() < definitions.TRACTOR_MAXIMUM_COLLECTED_PLANTS:
|
||||
field.get_plant().set_state(0)
|
||||
field.get_soil().set_is_fertilized(False)
|
||||
field.get_soil().set_water_level(False)
|
||||
field.get_soil().set_state(False)
|
||||
tractor1.set_collected_plants("potato", tractor1.get_collected_plants("potato") + 1)
|
||||
elif field.get_plant().get_name() == "wheat" and field.get_plant().get_state() == definitions.WHEAT_MAXIMUM_STATE and tractor1.get_all_collected_plants() < definitions.TRACTOR_MAXIMUM_COLLECTED_PLANTS:
|
||||
field.get_plant().set_state(0)
|
||||
field.get_soil().set_is_fertilized(False)
|
||||
@ -70,16 +146,22 @@ def grow_plants():
|
||||
for i in range(10):
|
||||
for j in range(10):
|
||||
field = fields[i][j]
|
||||
if field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.WHEAT_MAXIMUM_STATE:
|
||||
if field.get_plant().get_name() == "beetroot" and field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.BEETROOTS_MAXIMUM_STATE:
|
||||
field.get_plant().set_state(field.get_plant().get_state() + 1)
|
||||
elif field.get_plant().get_name() == "carrot" and field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.CARROTS_MAXIMUM_STATE:
|
||||
field.get_plant().set_state(field.get_plant().get_state() + 1)
|
||||
elif field.get_plant().get_name() == "potato" and field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.POTATOES_MAXIMUM_STATE:
|
||||
field.get_plant().set_state(field.get_plant().get_state() + 1)
|
||||
elif field.get_plant().get_name() == "wheat" and field.get_plant().get_state() > 0 and field.get_plant().get_state() < definitions.WHEAT_MAXIMUM_STATE:
|
||||
field.get_plant().set_state(field.get_plant().get_state() + 1)
|
||||
def is_move_allowed(move, tractor1_rect):
|
||||
if ((move == 1) and (tractor1_rect.y + definitions.BLOCK_SIZE + definitions.BLOCK_SIZE <= definitions.HEIGHT)):
|
||||
if move == 1 and tractor1_rect.y + definitions.BLOCK_SIZE + definitions.BLOCK_SIZE <= definitions.HEIGHT:
|
||||
return True
|
||||
elif ((move == 2) and (tractor1_rect.x - definitions.BLOCK_SIZE >= 0)):
|
||||
elif move == 2 and tractor1_rect.x - definitions.BLOCK_SIZE >= 0:
|
||||
return True
|
||||
elif ((move == 3) and (tractor1_rect.x + definitions.BLOCK_SIZE + definitions.BLOCK_SIZE <= definitions.WIDTH)):
|
||||
elif move == 3 and tractor1_rect.x + definitions.BLOCK_SIZE + definitions.BLOCK_SIZE <= definitions.WIDTH:
|
||||
return True
|
||||
elif ((move == 4) and (tractor1_rect.y - definitions.BLOCK_SIZE >= 0)):
|
||||
elif move == 4 and tractor1_rect.y - definitions.BLOCK_SIZE >= 0:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
@ -87,22 +169,22 @@ def tractor1_handle_movement(tractor1, tractor1_rect):
|
||||
loop = True
|
||||
while loop and tractor1.get_fuel() > 0:
|
||||
random1 = random.randint(1, 4)
|
||||
if ((random1 == 1) and (is_move_allowed(1, tractor1_rect) is True)):
|
||||
if random1 == 1 and is_move_allowed(1, tractor1_rect) is True:
|
||||
tractor1.move_down()
|
||||
tractor1_rect.x = tractor1.get_x()
|
||||
tractor1_rect.y = tractor1.get_y()
|
||||
loop = False
|
||||
elif ((random1 == 2) and (is_move_allowed(2, tractor1_rect) is True)):
|
||||
elif random1 == 2 and is_move_allowed(2, tractor1_rect) is True:
|
||||
tractor1.move_left()
|
||||
tractor1_rect.x = tractor1.get_x()
|
||||
tractor1_rect.y = tractor1.get_y()
|
||||
loop = False
|
||||
elif ((random1 == 3) and (is_move_allowed(3, tractor1_rect) is True)):
|
||||
elif random1 == 3 and is_move_allowed(3, tractor1_rect) is True:
|
||||
tractor1.move_right()
|
||||
tractor1_rect.x = tractor1.get_x()
|
||||
tractor1_rect.y = tractor1.get_y()
|
||||
loop = False
|
||||
elif ((random1 == 4) and (is_move_allowed(4, tractor1_rect) is True)):
|
||||
elif random1 == 4 and is_move_allowed(4, tractor1_rect) is True:
|
||||
tractor1.move_up()
|
||||
tractor1_rect.x = tractor1.get_x()
|
||||
tractor1_rect.y = tractor1.get_y()
|
||||
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 698 B |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
BIN
resources/potatoes_stage4.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
@ -8,6 +8,8 @@ class Tractor:
|
||||
self.water_level = water_level
|
||||
self.x = x
|
||||
self.y = y
|
||||
def get_all_amount_of_seeds(self):
|
||||
return self.amount_of_seeds["beetroot"] + self.amount_of_seeds["carrot"] + self.amount_of_seeds["potato"] + self.amount_of_seeds["wheat"]
|
||||
def get_amount_of_seeds(self, name):
|
||||
return self.amount_of_seeds[name]
|
||||
def set_amount_of_seeds(self, name, value):
|
||||
|