Beispiel #1
0
#Put all idle momevemt frames into a list
idleList = []
for i in range(2):
    idleList.append(spriteList[0][i])

#Create new projectiles
testBullet = Projectile(bullet, 500, 2000, None, None)

# Create new test weapons
HEMG_weapon = Weapon(gun, testBullet, 95, 7, None, 75, None, 60, 2000)
nav_weapon = MeleeWeapon(bat, 0, 0, None, None, None, None, None, None)

#Create Map
map1 = MapGen(16, 3.2)
MapGen.mrGenny(map1)
map1.mrClassy()
pprint(map1.level)

#Set up camera
cspeed = 400

#Make camera start in middle of start room
for i in range(len(map1.level)):
    for n in range(len(map1.level[i])):
        if map1.level[i][n] == 5:
            playerX, playerY = n * roomScale + roomScale / 2, i * roomScale + roomScale / 2

#create character instance
susano = Player('martialArtist', playerX, playerY, 1000)

#Create clock
#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)


#Players