commit 4d2e2bb52b85f6e040ec2bd3914285bf35569dc1 Author: emil Date: Sat Oct 12 08:06:45 2024 +0300 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d02a44c --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/.idea +/.venv +/Graphs +/__pycache__ \ No newline at end of file diff --git a/entities.py b/entities.py new file mode 100644 index 0000000..8602993 --- /dev/null +++ b/entities.py @@ -0,0 +1,45 @@ +import numpy as np + +class Entity: + position = np.array([0,0]) + name = "" + def __init__(self, InitialPosition, name): + self.position = InitialPosition + self.name = name + + +class Actor(Entity): + perceptionRadius = 0 + percievedCells = None + def __init__(self, InitialPosition, name, perceptionRadius): + super().__init__(InitialPosition, name) + self.perceptionRadius = perceptionRadius + + +class Neo(Actor): + keyMakerPosition = np.array([0,0]) + def __init__(self, InitialPosition, perceptionRadius, keyMakerPosition): + super().__init__(InitialPosition, "Neo", perceptionRadius) + self.keyMakerPosition = keyMakerPosition + +class Smith(Actor): + def __init__(self, InitialPosition, perceptionRadius): + super().__init__(InitialPosition, "Smith", perceptionRadius) + def Kill(): + print("Neo is killed.") #TODO: delete + +class Sentinel(Actor): + def __init__(self, InitialPosition, perceptionRadius): + super().__init__(InitialPosition, "Sentinel", perceptionRadius) + def Kill(): + print("Neo is killed.") #TODO: delete + +class Keymaker(Entity): + def __init__(self, InitialPosition): + super().__init__(InitialPosition, "Keymaker") + +class BackdoorKey(Entity): + def __init__(self, InitialPosition): + super().__init__(InitialPosition, "BackdoorKey") + + diff --git a/main.py b/main.py new file mode 100644 index 0000000..93c179a --- /dev/null +++ b/main.py @@ -0,0 +1,14 @@ +import pygame as pg +from map import * + +cell = Cell(coordinates=np.array([50,50])) + +running = True + +while (running): + for event in pg.event.get(): + if event.type == pg.QUIT: + running = False + screen.fill('BLACK') + cell.draw() + \ No newline at end of file diff --git a/map.py b/map.py new file mode 100644 index 0000000..3024e06 --- /dev/null +++ b/map.py @@ -0,0 +1,21 @@ +import numpy as np +import pygame as pg + +screen = pg.display.set_mode([512,512]) +pg.display.set_caption("Matrix Universe") +pg.init() +class Cell: + coordinates = np.array([0,0]) + position = np.array([0,0]) + size = 50 + piece = pg.draw.rect(screen, (255,255,255), (0, 0, size, size)) + def __init__(self, coordinates): + self.coordinates = coordinates + self.position = coordinates // self.size + def draw(self): + screen.blit(screen, self.coordinates ,self.piece) + +class Map: + cellGrid = None + def __init__(self): + pass \ No newline at end of file