Exemplo n.º 1
0
mapScale = 256

#Init calls
p.init()
MapGen.initGraphics(mapScale)

#Set up screen
tscreenX, tscreenY = 800, 600
screenX, screenY = 200, 150
screen = p.display.set_mode((tscreenX, tscreenY))
centerX, centerY = int(tscreenX / 2), int(tscreenY / 2)

#Create Objects
#Generate the map
map1 = MapGen(16, 3.2)
map1.mrGenny()
map1.mrClassy()
map1.mrRoomy()
pprint(map1.layoutMap)

#Create clock
clock = p.time.Clock()


#Move function for testing
def move(cameraX, cameraY, speed, currentTimeDelta):
    POFFX, POFFY = 0, 0  #Camera direction variables

    #Determine direction of movement
    if p.key.get_pressed()[p.K_d]:  #Right
        POFFX = 1
Exemplo n.º 2
0
MapGen.initGraphics(mapScale) #Load map images

#Set up screen
screenX, screenY = Setup.screenX, Setup.screenY
screen = p.display.set_mode((screenX, screenY))
centerX, centerY = Setup.centerX, Setup.centerY
#Set up window
p.display.set_icon(p.image.load('assets/ui/logo.png'))
p.display.set_caption("Dungeon")


#Object Setups =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#Create Map
numOfElements = 16 
map1 = MapGen(numOfElements,3.2) #Create level map
map1.mrGenny() #Generate the room layout
map1.mrClassy() #Determine the type of room depending on the amount of exits has
map1.mrRoomy() #Generate the room layout of each room
map1.mrCollidey() #Merge the collsion data of the room and room layout
map1.mrDoory(scale) #Create all the doors

#Make a 2d array with all the collision data of all the rooms
for i in range(len(map1.level)): #Iterate through each room of map
    for n in range(len(map1.level[i])):
        rawMapCollide = Collider.importCollisionMap(n,i,numOfElements,map1.roomCollide[i][n],scale) #Create actual rect collision objects
        mapCollide = Collider.convertCollisionGrid(n,i,rawMapCollide,scale,numOfElements)
        map1.mrCollisionData[i][n] = mapCollide
        
pprint(map1.level)