diff --git a/__pycache__/tractor.cpython-310.pyc b/__pycache__/tractor.cpython-310.pyc index c375915..5a6779d 100644 Binary files a/__pycache__/tractor.cpython-310.pyc and b/__pycache__/tractor.cpython-310.pyc differ diff --git a/main.py b/main.py index 1ccf489..881adbc 100644 --- a/main.py +++ b/main.py @@ -1,23 +1,35 @@ import pygame +import sys import tractor -import screen +import src.screen as screen +import src.plant as plant +from src.Tractor import Tractor as ractor2 +#import src.tractor as tractor2 # pygame initialization pygame.init() +pygame.mouse.set_visible(False) + +# #new tractor sprite - todo +# tr=tractor2('oil','manual',36,36) +# tr_group = pygame.sprite.Group() +# tr_group.add() # creating agent myTractor = tractor.Tractor -if __name__ == "__main__": - running = True +#if __name__ == "__main__": +running = True - while running: - for event in pygame.event.get(): - if event.type == pygame.QUIT: - running = False - # defines agent movement - tractor.movement(myTractor) - # screen visualisation - screen.set_screen(myTractor) - - pygame.quit() \ No newline at end of file +while running: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + pygame.quit() + sys.exit() + # defines agent movement + tractor.movement(myTractor) + # screen visualisation + screen.set_screen(myTractor) + +#pygame.quit() \ No newline at end of file diff --git a/main2.py b/main2.py new file mode 100644 index 0000000..b0ff5f5 --- /dev/null +++ b/main2.py @@ -0,0 +1,45 @@ +import pygame +import sys +import tractor +import src.screen as screen +import src.plant as plant + +class Tractor2(pygame.sprite.Sprite): + def __init__(self,engine,transmission,pos_x,pos_y): + super.__init__() + self.image=pygame.image.load("../assets/tractor/tractor.png") + self.image=pygame.transform.scale(self,(36,36)) + self.rect = self.image.get_rect() + + self.engine=engine + self.transmission=transmission + self.pos_x=pos_x + self.pos_y=pos_y + self.fuel=100 + + def update(self): + self.rect.center=pygame.mouse.get_pos() + # self.pos_x=pos_x + # self.pos_y=pos_y + +# pygame initialization +pygame.init() +pygame.mouse.set_visible(False) + + +myTractor = tractor.Tractor + +if __name__ == "__main__": + running = True + + while running: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + pygame.quit() + sys.exit() + # defines agent movement + tractor.movement(myTractor) + # screen visualisation + screen.set_screen(myTractor) + diff --git a/src/Tractor.py b/src/Tractor.py new file mode 100644 index 0000000..8604da1 --- /dev/null +++ b/src/Tractor.py @@ -0,0 +1,30 @@ +from pygame.sprite import Sprite +import pygame + +class Tractor(pygame.sprite.Sprite): + def __init__(self,engine,transmission,pos_x,pos_y): + super.__init__() + self.image=pygame.image.load("../assets/tractor/tractor.png") + self.image=pygame.transform.scale(self,(36,36)) + self.rect = self.image.get_rect() + + self.engine=engine + self.transmission=transmission + self.pos_x=pos_x + self.pos_y=pos_y + self.fuel=100 + + def update(self): + self.rect.center=pygame.mouse.get_pos() + # self.pos_x=pos_x + # self.pos_y=pos_y + + def movement(self): + print("todo") + + + def rotation(self,direction): + print("todo") + + + diff --git a/src/__pycache__/Tractor.cpython-310.pyc b/src/__pycache__/Tractor.cpython-310.pyc new file mode 100644 index 0000000..54738c9 Binary files /dev/null and b/src/__pycache__/Tractor.cpython-310.pyc differ diff --git a/src/__pycache__/plant.cpython-310.pyc b/src/__pycache__/plant.cpython-310.pyc new file mode 100644 index 0000000..4605e26 Binary files /dev/null and b/src/__pycache__/plant.cpython-310.pyc differ diff --git a/src/__pycache__/screen.cpython-310.pyc b/src/__pycache__/screen.cpython-310.pyc new file mode 100644 index 0000000..de53c8c Binary files /dev/null and b/src/__pycache__/screen.cpython-310.pyc differ diff --git a/src/__pycache__/tractor.cpython-310.pyc b/src/__pycache__/tractor.cpython-310.pyc new file mode 100644 index 0000000..1a4249d Binary files /dev/null and b/src/__pycache__/tractor.cpython-310.pyc differ diff --git a/src/plant.py b/src/plant.py index 4926861..997bc8d 100644 --- a/src/plant.py +++ b/src/plant.py @@ -31,3 +31,4 @@ class Plant(Sprite): self.fertilizer="wheat_fertilizer" self.pic_path="assets/Wheat.png" + \ No newline at end of file diff --git a/screen.py b/src/screen.py similarity index 100% rename from screen.py rename to src/screen.py diff --git a/src/tractor.py b/src/tractor.py deleted file mode 100644 index eec13e4..0000000 --- a/src/tractor.py +++ /dev/null @@ -1,12 +0,0 @@ -from pygame.sprite import Sprite - -class Plant(Sprite): - def __init__(self,engine,transmission,pos_x,pos_y): - super.__init__() - self.engine=engine - self.transmission=transmission - self.pos_x=pos_x - self.pos_y=pos_y - self.fuel=100 - -