add-tractor #10
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
__pycache__/
|
9
agent.py
9
agent.py
@ -3,10 +3,11 @@ import settings
|
|||||||
|
|
||||||
|
|
||||||
class Instance:
|
class Instance:
|
||||||
def __init__(self):
|
def __init__(self, tank_capacity):
|
||||||
size = settings.Field.size
|
size = settings.Field.size
|
||||||
self.rect = pygame.Rect(0, 0, size(), size())
|
self.rect = pygame.Rect(0, 0, size(), size())
|
||||||
self.action = ''
|
self.action = ''
|
||||||
|
self.tank_capacity = tank_capacity
|
||||||
|
|
||||||
def coordinates(self):
|
def coordinates(self):
|
||||||
return {
|
return {
|
||||||
@ -20,6 +21,12 @@ class Instance:
|
|||||||
def y(self):
|
def y(self):
|
||||||
return int(self.rect.y / settings.Field.size())
|
return int(self.rect.y / settings.Field.size())
|
||||||
|
|
||||||
|
def get_tank_capacity(self):
|
||||||
|
return self.tank_capacity
|
||||||
|
|
||||||
|
def set_tank_capacity(self, fuel_units):
|
||||||
|
self.tank_capacity = fuel_units
|
||||||
|
|
||||||
def move(self):
|
def move(self):
|
||||||
key_pressed = pygame.key.get_pressed()
|
key_pressed = pygame.key.get_pressed()
|
||||||
height = settings.Pygame.height()
|
height = settings.Pygame.height()
|
||||||
|
BIN
assets/tracktor/tractor.png
Normal file
BIN
assets/tracktor/tractor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.0 KiB |
4
main.py
4
main.py
@ -6,7 +6,7 @@ import settings
|
|||||||
import common
|
import common
|
||||||
import agent
|
import agent
|
||||||
|
|
||||||
AGENT_IMG = pygame.image.load("dot-22-433567.png")
|
AGENT_IMG = pygame.image.load('./assets/tracktor/tractor.png')
|
||||||
AGENT = pygame.transform.scale(AGENT_IMG, (settings.Field.size(), settings.Field.size()))
|
AGENT = pygame.transform.scale(AGENT_IMG, (settings.Field.size(), settings.Field.size()))
|
||||||
|
|
||||||
possibleFields = {
|
possibleFields = {
|
||||||
@ -65,7 +65,7 @@ def draw_window(agent, fields):
|
|||||||
|
|
||||||
|
|
||||||
common = common.Instance()
|
common = common.Instance()
|
||||||
agent = agent.Instance()
|
agent = agent.Instance(1000)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
Reference in New Issue
Block a user