mini zmiany

This commit is contained in:
Tomasz Adamczyk 2021-03-23 17:54:39 +01:00
parent c2a32568f7
commit a431a57049
8 changed files with 21 additions and 22 deletions

View File

@ -4,9 +4,7 @@
<list default="true" id="56453584-72bd-49f4-a39c-fccf91ab20c6" name="Default Changelist" comment=""> <list default="true" id="56453584-72bd-49f4-a39c-fccf91ab20c6" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <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$/definitions.py" beforeDir="false" afterPath="$PROJECT_DIR$/definitions.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/plant.py" beforeDir="false" afterPath="$PROJECT_DIR$/plant.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/py.py" beforeDir="false" afterPath="$PROJECT_DIR$/py.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/py.py" beforeDir="false" afterPath="$PROJECT_DIR$/py.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tractor.py" beforeDir="false" afterPath="$PROJECT_DIR$/tractor.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -86,6 +84,8 @@
<workItem from="1616428378038" duration="453000" /> <workItem from="1616428378038" duration="453000" />
<workItem from="1616510487017" duration="5321000" /> <workItem from="1616510487017" duration="5321000" />
<workItem from="1616515878589" duration="110000" /> <workItem from="1616515878589" duration="110000" />
<workItem from="1616517453952" duration="124000" />
<workItem from="1616517732434" duration="704000" />
</task> </task>
<servers /> <servers />
</component> </component>
@ -93,22 +93,22 @@
<option name="version" value="1" /> <option name="version" value="1" />
</component> </component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state width="1879" height="295" key="GridCell.Tab.0.bottom" timestamp="1616515989422"> <state width="1879" height="295" key="GridCell.Tab.0.bottom" timestamp="1616518442382">
<screen x="0" y="0" width="1920" height="1080" /> <screen x="0" y="0" width="1920" height="1080" />
</state> </state>
<state width="1879" height="295" key="GridCell.Tab.0.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1616515989422" /> <state width="1879" height="295" key="GridCell.Tab.0.bottom/0.0.1920.1080@0.0.1920.1080" timestamp="1616518442382" />
<state width="1879" height="295" key="GridCell.Tab.0.center" timestamp="1616515989422"> <state width="1879" height="295" key="GridCell.Tab.0.center" timestamp="1616518442382">
<screen x="0" y="0" width="1920" height="1080" /> <screen x="0" y="0" width="1920" height="1080" />
</state> </state>
<state width="1879" height="295" key="GridCell.Tab.0.center/0.0.1920.1080@0.0.1920.1080" timestamp="1616515989422" /> <state width="1879" height="295" key="GridCell.Tab.0.center/0.0.1920.1080@0.0.1920.1080" timestamp="1616518442382" />
<state width="1879" height="295" key="GridCell.Tab.0.left" timestamp="1616515989422"> <state width="1879" height="295" key="GridCell.Tab.0.left" timestamp="1616518442382">
<screen x="0" y="0" width="1920" height="1080" /> <screen x="0" y="0" width="1920" height="1080" />
</state> </state>
<state width="1879" height="295" key="GridCell.Tab.0.left/0.0.1920.1080@0.0.1920.1080" timestamp="1616515989422" /> <state width="1879" height="295" key="GridCell.Tab.0.left/0.0.1920.1080@0.0.1920.1080" timestamp="1616518442382" />
<state width="1879" height="295" key="GridCell.Tab.0.right" timestamp="1616515989422"> <state width="1879" height="295" key="GridCell.Tab.0.right" timestamp="1616518442382">
<screen x="0" y="0" width="1920" height="1080" /> <screen x="0" y="0" width="1920" height="1080" />
</state> </state>
<state width="1879" height="295" key="GridCell.Tab.0.right/0.0.1920.1080@0.0.1920.1080" timestamp="1616515989422" /> <state width="1879" height="295" key="GridCell.Tab.0.right/0.0.1920.1080@0.0.1920.1080" timestamp="1616518442382" />
<state width="1879" height="364" key="GridCell.Tab.1.bottom" timestamp="1616326478876"> <state width="1879" height="364" key="GridCell.Tab.1.bottom" timestamp="1616326478876">
<screen x="0" y="0" width="1920" height="1080" /> <screen x="0" y="0" width="1920" height="1080" />
</state> </state>
@ -125,12 +125,12 @@
<screen x="0" y="0" width="1920" height="1080" /> <screen x="0" y="0" width="1920" height="1080" />
</state> </state>
<state width="1879" height="364" key="GridCell.Tab.1.right/0.0.1920.1080@0.0.1920.1080" timestamp="1616326478875" /> <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="1616515879771"> <state x="0" y="0" key="com.intellij.ide.util.TipDialog" timestamp="1616517731968">
<screen x="0" y="0" width="1920" height="1080" /> <screen x="0" y="0" width="1920" height="1080" />
</state> </state>
<state x="0" y="0" key="com.intellij.ide.util.TipDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1616515879771" /> <state x="0" y="0" key="com.intellij.ide.util.TipDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1616517731968" />
</component> </component>
<component name="com.intellij.coverage.CoverageDataManagerImpl"> <component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/SmartTractor$py.coverage" NAME="py Coverage Results" MODIFIED="1616515897525" 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="1616518408138" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component> </component>
</project> </project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,7 @@ WIN = pygame.display.set_mode((WIDTH, HEIGHT))
TRACTOR = pygame.image.load(os.path.join('resources', 'tractor.png')) TRACTOR = pygame.image.load(os.path.join('resources', 'tractor.png'))
TRACTOR = pygame.transform.scale(TRACTOR, (BLOCK_SIZE, BLOCK_SIZE)) TRACTOR = pygame.transform.scale(TRACTOR, (BLOCK_SIZE, BLOCK_SIZE))
WHEAT_GROW_TIME = 5 WHEAT_GROW_TIME = 5
WHEAT_MAXIMUM_STATE = 22 WHEAT_MAXIMUM_STATE = 21
WHEATSTAGE1 = pygame.image.load(os.path.join('resources', 'wheat_stage1.png')) WHEATSTAGE1 = pygame.image.load(os.path.join('resources', 'wheat_stage1.png'))
WHEATSTAGE1 = pygame.transform.scale(WHEATSTAGE1, (BLOCK_SIZE, BLOCK_SIZE)) WHEATSTAGE1 = pygame.transform.scale(WHEATSTAGE1, (BLOCK_SIZE, BLOCK_SIZE))
WHEATSTAGE2 = pygame.image.load(os.path.join('resources', 'wheat_stage2.png')) WHEATSTAGE2 = pygame.image.load(os.path.join('resources', 'wheat_stage2.png'))

15
py.py
View File

@ -22,15 +22,15 @@ def fill_map():
for j in range(10): for j in range(10):
field = fields[i][j] field = fields[i][j]
rect = field.get_rect() rect = field.get_rect()
if field.get_plant().get_state() > 0 and field.get_plant().get_state() <= 1 * definitions.WHEAT_GROW_TIME + 1: if field.get_plant().get_state() > 0 and field.get_plant().get_state() <= 1 * definitions.WHEAT_GROW_TIME:
block = definitions.WHEATSTAGE1 block = definitions.WHEATSTAGE1
elif field.get_plant().get_state() > 1 * definitions.WHEAT_GROW_TIME + 1 and field.get_plant().get_state() <= 2 * definitions.WHEAT_GROW_TIME + 1: elif field.get_plant().get_state() > 1 * definitions.WHEAT_GROW_TIME and field.get_plant().get_state() <= 2 * definitions.WHEAT_GROW_TIME:
block = definitions.WHEATSTAGE2 block = definitions.WHEATSTAGE2
elif field.get_plant().get_state() > 2 * definitions.WHEAT_GROW_TIME + 1 and field.get_plant().get_state() <= 3 * definitions.WHEAT_GROW_TIME + 1: elif field.get_plant().get_state() > 2 * definitions.WHEAT_GROW_TIME and field.get_plant().get_state() <= 3 * definitions.WHEAT_GROW_TIME:
block = definitions.WHEATSTAGE3 block = definitions.WHEATSTAGE3
elif field.get_plant().get_state() > 3 * definitions.WHEAT_GROW_TIME + 1 and field.get_plant().get_state() <= 4 * definitions.WHEAT_GROW_TIME + 1: elif field.get_plant().get_state() > 3 * definitions.WHEAT_GROW_TIME and field.get_plant().get_state() <= 4 * definitions.WHEAT_GROW_TIME:
block = definitions.WHEATSTAGE4 block = definitions.WHEATSTAGE4
elif field.get_plant().get_state() == 4 *definitions.WHEAT_GROW_TIME + 2: elif field.get_plant().get_state() == 4 *definitions.WHEAT_GROW_TIME + 1:
block = definitions.WHEATSTAGE5 block = definitions.WHEATSTAGE5
elif field.get_soil().get_state() is False: elif field.get_soil().get_state() is False:
block = definitions.DIRT block = definitions.DIRT
@ -102,7 +102,6 @@ def main():
create_base_map() create_base_map()
tractor1 = tractor.Tractor(0, 0) tractor1 = tractor.Tractor(0, 0)
tractor1_rect = pygame.Rect(tractor1.get_x(), tractor1.get_y(), definitions.BLOCK_SIZE, definitions.BLOCK_SIZE) tractor1_rect = pygame.Rect(tractor1.get_x(), tractor1.get_y(), definitions.BLOCK_SIZE, definitions.BLOCK_SIZE)
draw_window(tractor1_rect)
clock = pygame.time.Clock() clock = pygame.time.Clock()
run = True run = True
while run: while run:
@ -110,10 +109,10 @@ def main():
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
run = False run = False
draw_window(tractor1_rect)
grow_plants()
tractor1_handle_movement(tractor1, tractor1_rect) tractor1_handle_movement(tractor1, tractor1_rect)
do_work(tractor1_rect) do_work(tractor1_rect)
grow_plants()
draw_window(tractor1_rect)
pygame.quit() pygame.quit()
if __name__ == "__main__": if __name__ == "__main__":
main() main()