Esempio n. 1
0
 def GetRandomPointInCircle(self, radius) -> V2:
     t = 2*math.pi*random.random()
     u = random.random()+random.random()
     r = 0
     if u > 1:
         r = 2-u 
     else: 
         r = u
     return V2(round(radius*r*math.cos(t)), round(radius*r*math.sin(t)))
Esempio n. 2
0
 def __init__(self, data, pos:V2, id):
     self.width = len(data[0])
     self.height = len(data)
     self.overlay = []
     self.data = self._generateMapData(data)
     self.uniqueRoomID = id
     self.position = pos
     self.rect = Rectangle( V2( self.position.x, self.position.y + self.height ),  V2( self.position.x + self.width, self.position.y ) )
     self._isColliding = False
 def __init__(self, viewWidth, viewHeight):
     self.width = viewWidth
     self.height = viewHeight
     self.position = V2(0,0)
     self.borderChar = "#"
     self.rect = Rectangle( V2( self.position.x - math.floor(self.width/2), self.position.y + math.floor(self.height/2)),  V2( self.position.x + math.floor(self.width/2), self.position.y - math.floor(self.height/2)))
 def Update(self, playerPosition):
     self.position = playerPosition
     self.rect = Rectangle( V2( self.position.x - math.floor(self.width/2), self.position.y + math.floor(self.height/2)),  V2( self.position.x + math.floor(self.width/2), self.position.y - math.floor(self.height/2)))
Esempio n. 5
0
 def _updatePosY(self, y:int):
     self.position.y = y
     self.rect = Rectangle( V2( self.position.x, self.position.y + self.height ),  V2( self.position.x + self.width, self.position.y ) )
Esempio n. 6
0
 def _updatePosX(self, x:int):
     self.position.x = x
     self.rect = Rectangle( V2( self.position.x, self.position.y + self.height ),  V2( self.position.x + self.width, self.position.y ) )
Esempio n. 7
0
            for x in range(len(mapToRender[y])):
                builtRow += mapToRender[y][x]
            print(builtRow)

        self.culledMapData = mapToRender



if __name__ == "__main__":
    g = LevelGenerator()
    g.GenerateStartingRooms(5, 5, 1)
    

    cam = Camera(49, 11)
    
    playerPos = V2(0,0)

    cam.Update(playerPos)
    #g.DrawRooms(cam)
    
    
    while True:
        g.DrawRooms(cam)

        move = input()
        s = 5
        if move == "w":
            playerPos.y -= 1 * s
        elif move == "s":
            playerPos.y += 1 * s
        elif move == "a":