加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
map.py 57.22 KB
一键复制 编辑 原始数据 按行查看 历史
HURUIZHE 提交于 2022-01-17 20:45 . Our game
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779
import pygame
import numpy as np
import enemy
import Buff
import Trap
class Blocks:
def __init__(self):
self.image = pygame.image.load(r"image\temple.png").convert_alpha()
self.rect = self.image.get_rect()
self.size = 24
self.coord_x = self.rect.left + 12
self.coord_y = self.rect.top + 12
class a_star_block:
def __init__(self, x, y):
self.coord_x = x
self.coord_y = y
self.F = 0
self.H = 0
self.G = 0
self.prev = [-1, -1]
class Up_Door:
def __init__(self):
self.image = pygame.image.load(r"image\up_door.png").convert_alpha()
self.rect = self.image.get_rect()
self.size = 24
self.coord_x = self.rect.left + 12
self.coord_y = self.rect.top + 12
class Down_Door:
def __init__(self):
self.image = pygame.image.load(r"image\down_door.png").convert_alpha()
self.rect = self.image.get_rect()
self.size = 24
self.coord_x = self.rect.left + 12
self.coord_y = self.rect.top + 12
class Right_Door:
def __init__(self):
self.image = pygame.image.load(r"image\right_door.png").convert_alpha()
self.rect = self.image.get_rect()
self.size = 24
self.coord_x = self.rect.left + 12
self.coord_y = self.rect.top + 12
class Left_Door:
def __init__(self):
self.image = pygame.image.load(r"image\left_door.png").convert_alpha()
self.rect = self.image.get_rect()
self.size = 24
self.coord_x = self.rect.left + 12
self.coord_y = self.rect.top + 12
class Special_Door:
def __init__(self):
self.image = pygame.image.load(r"image\special_door.png").convert_alpha()
self.rect = self.image.get_rect()
self.size = 24
self.coord_x = self.rect.left + 12
self.coord_y = self.rect.top + 12
class Border:
def __init__(self):
self.image = pygame.image.load(r"image\border.png").convert_alpha()
self.rect = self.image.get_rect()
self.size = 24
self.coord_x = self.rect.left + 12
self.coord_y = self.rect.top + 12
class Little_head:
def __init__(self):
self.image = pygame.image.load(r"image\little_head.png").convert_alpha()
self.rect = self.image.get_rect()
self.size = 16
self.coord_x = self.rect.left + 8
self.coord_y = self.rect.top + 8
class Rock:
def __init__(self):
self.image = pygame.image.load(r"image\rock.png").convert_alpha()
self.rect = self.image.get_rect()
self.coord_x = self.rect.left + 72
self.coord_y = self.rect.top + 50
def SmallMap(self):
self.blockGroup = list()
X1 = [630, 678, 702, 726]
Y1 = [72]
X2 = [630, 654, 678, 726]
Y2 = [96]
X3 = [630, 678, 702, 726]
Y3 = [120]
X4 = [654, 678, 702]
Y4 = [144]
X5 = [630, 678]
Y5 = [168]
X6 = [630, 654, 678, 702, 726]
Y6 = [192]
X7 = [726]
Y7 = [216]
for x in X1:
for y in Y1:
self.block = Border()
self.block.rect.left, self.block.rect.top = x, y
self.blockGroup.append(self.block)
for y in Y2:
for x in X2:
self.block = Border()
self.block.rect.left, self.block.rect.top = x, y
self.blockGroup.append(self.block)
for x in X3:
for y in Y3:
self.block = Border()
self.block.rect.left, self.block.rect.top = x, y
self.blockGroup.append(self.block)
for x in X4:
for y in Y4:
self.block = Border()
self.block.rect.left, self.block.rect.top = x, y
self.blockGroup.append(self.block)
for x in X5:
for y in Y5:
self.block = Border()
self.block.rect.left, self.block.rect.top = x, y
self.blockGroup.append(self.block)
for y in Y6:
for x in X6:
self.block = Border()
self.block.rect.left, self.block.rect.top = x, y
self.blockGroup.append(self.block)
for y in Y7:
for x in X7:
self.block = Border()
self.block.rect.left, self.block.rect.top = x, y
self.blockGroup.append(self.block)
# initialize parameters
def init_para(self):
self.enemy_number = 4
self.over = False
self.doorGroup = list()
self.traps = list()
self.enemies = list()
self.steady_buff = list()
self.blockGroup = list()
self.size = 24
self.maze = np.zeros(shape=(630, 630))
self.block_maze = np.zeros(shape=(26, 26)) # narrowed maze, "1" marks the wall block
self.sound = pygame.mixer.Sound("sound/soundtrack/Eclipse.mp3")
self.sound.set_volume(0.4)
# assign map1 value
def map1_para(self):
self.traps.append(Trap.Traps(147, 435, 0, True))
self.enemies.append(enemy.Enemy(1, 27, 315))
self.enemies.append(enemy.Enemy(1, 531, 123))
self.enemies.append(enemy.Enemy(2, 219, 147))
self.enemies.append(enemy.Enemy(2, 531, 504))
self.steady_buff.append(Buff.BuffStuff(50, 300, 3))
self.steady_buff.append(Buff.BuffStuff(420, 200, 1))
# assign map2 value
def map2_para(self):
self.traps.append(Trap.Traps(243, 339, 0, False))
self.enemies.append(enemy.Enemy(1, 27, 27))
self.enemies.append(enemy.Enemy(1, 363, 363))
self.enemies.append(enemy.Enemy(2, 483, 51))
self.enemies.append(enemy.Enemy(2, 51, 315))
self.steady_buff.append(Buff.BuffStuff(291, 195, 3))
self.steady_buff.append(Buff.BuffStuff(171, 411, 0))
# assign map3 value
def map3_para(self):
self.traps.append(Trap.Traps(363, 267, 1, True))
self.enemies.append(enemy.Enemy(1, 27, 243))
self.enemies.append(enemy.Enemy(1, 267, 459))
self.enemies.append(enemy.Enemy(2, 243, 171))
self.enemies.append(enemy.Enemy(2, 531, 143))
self.steady_buff.append(Buff.BuffStuff(51, 51, 2))
self.steady_buff.append(Buff.BuffStuff(387, 171, 0))
# assign map4 value
def map4_para(self):
self.traps.append(Trap.Traps(339, 147, 1, False))
self.enemies.append(enemy.Enemy(1, 51, 75))
self.enemies.append(enemy.Enemy(1, 411, 435))
self.enemies.append(enemy.Enemy(2, 483, 99))
self.enemies.append(enemy.Enemy(2, 171, 291))
self.steady_buff.append(Buff.BuffStuff(315, 267, 2))
self.steady_buff.append(Buff.BuffStuff(123, 435, 1))
# assign boss room value
def map5_para(self):
self.traps.append(Trap.Traps(483, 195, 1, True))
self.steady_buff.append(Buff.BuffStuff(51, 219, 3))
self.steady_buff.append(Buff.BuffStuff(507, 339, 2))
self.enemies.append(enemy.Enemy(1, 483, 483))
self.enemies.append(enemy.Enemy(2, 51, 483))
self.enemies.append(enemy.Enemy(2, 483, 75))
self.enemies.append(enemy.Enemy(3, 267, 267))
# assign special room value
def map6_para(self):
self.traps.append(Trap.Traps(411, 291, 1, True))
self.steady_buff.append(Buff.BuffStuff(339, 75, 3))
self.steady_buff.append(Buff.BuffStuff(339, 171, 1))
self.steady_buff.append(Buff.BuffStuff(531, 435, 0))
self.enemies.append(enemy.Enemy(2, 267, 75))
self.enemies.append(enemy.Enemy(2, 51, 99))
self.enemies.append(enemy.Enemy(2, 195, 315))
self.enemies.append(enemy.Enemy(2, 75, 411))
# wall generation
def make_wall1(self):
X1 = [4, 5]
Y1 = [5, 6, 7, 8, 9, 10, 19, 20, 21, 22, 23, 24]
X21 = [8]
Y21 = [6, 7, 8, 9, 10, 11, 12, 13]
X22 = [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
Y22 = [5]
X3 = [18, 19]
Y3 = [1, 2, 3, 4]
X4 = [13, 14]
Y4 = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
X5 = [9, 10, 11, 12]
Y5 = [20]
X6 = [19, 20, 21, 22, 23, 24]
Y6 = [12]
X7 = [19]
Y7 = [13, 14, 15, 16, 17, 18, 19, 20]
for x in X1:
for y in Y1:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y21:
for x in X21:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y22:
for x in X22:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X3:
for y in Y3:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X4:
for y in Y4:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X5:
for y in Y5:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y6:
for x in X6:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X7:
for y in Y7:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
def make_wall2(self):
X21 = [5]
Y21 = [5, 6, 7, 8, 9, 10, 11, 12]
X22 = [4, 5]
Y22 = [18, 19, 20, 21, 22, 23, 24]
X3 = [9, 16]
Y3 = [5, 6, 7, 8, 9, 10, 11]
X4 = [10, 11, 12, 13, 14, 15]
Y4 = [5]
X5 = [17, 18, 19, 20, 21]
Y5 = [7, 8]
X6 = [20, 21]
Y6 = [13, 14, 15]
X7 = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
Y7 = [20, 21]
for y in Y21:
for x in X21:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.block_maze[y, x] = 1
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y22:
for x in X22:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.block_maze[y, x] = 1
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X3:
for y in Y3:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.block_maze[y, x] = 1
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X4:
for y in Y4:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.block_maze[y, x] = 1
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X5:
for y in Y5:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.block_maze[y, x] = 1
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y6:
for x in X6:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.block_maze[y, x] = 1
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X7:
for y in Y7:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.block_maze[y, x] = 1
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
def make_wall3(self):
X1 = [4, 5, 20, 21]
Y1 = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
X21 = [10]
Y21 = [5, 6, 7, 8, 9, 10]
X22 = [11, 12, 13, 14]
Y22 = [5]
X3 = [15]
Y3 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
X4 = [19, 20, 21, 22, 23, 24]
Y4 = [4]
X5 = [10]
Y5 = [17, 18, 19, 20, 21, 22, 23, 24]
X6 = [10, 11, 12, 13, 14, 15, 16]
Y6 = [17, 18]
for x in X1:
for y in Y1:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y21:
for x in X21:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y22:
for x in X22:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X3:
for y in Y3:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X4:
for y in Y4:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X5:
for y in Y5:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y6:
for x in X6:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
def make_wall4(self):
X1 = [5, 6]
Y1 = [5, 6, 7, 8, 9]
Y21 = [5, 6, 7, 8]
X21 = [10]
X22 = [11]
Y22 = [8]
X3 = [12]
Y3 = [8, 9, 10, 11, 12, 13, 14, 15, 16]
X4 = [8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
Y4 = [17]
X5 = [1, 2, 3, 4]
Y5 = [14]
X6 = [4]
Y6 = [15, 16, 17, 18, 19, 20, 21]
X7 = [8, 9, 16, 17]
Y7 = [23, 24]
X8 = [17]
Y8 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
X9 = [21]
Y9 = [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
for x in X1:
for y in Y1:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y21:
for x in X21:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y22:
for x in X22:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X3:
for y in Y3:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X4:
for y in Y4:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X5:
for y in Y5:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y6:
for x in X6:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y7:
for x in X7:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y8:
for x in X8:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y9:
for x in X9:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
def make_wall5(self):
X1 = [8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
Y1 = [6, 19]
X2 = [7, 18]
Y2 = [6, 7, 8, 9, 10, 15, 16, 17, 18, 19]
for x in X1:
for y in Y1:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X2:
for y in Y2:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
def make_wall6(self):
X1 = [4, 5, 6, 7, 18, 19, 20, 21]
Y1 = [4, 5, 6, 7]
X2 = [7, 8, 12, 13, 17, 18]
Y2 = [18, 19, 20, 21]
X3 = [9, 10, 11, 14, 15, 16]
Y3 = [20, 21]
for x in X1:
for y in Y1:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for y in Y2:
for x in X2:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X3:
for y in Y3:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
# corridor
def make_wall8(self):
X1 = [1, 7, 13, 19]
Y1 = [4]
X2 = [1, 7, 13, 19]
Y2 = [17]
for x in X1:
for y in Y1:
self.block = Rock()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 147 + x * 24):
for yi in range(3 + y * 24, 102 + y * 24):
self.maze[xi, yi] = 1
for y in Y2:
for x in X2:
self.block = Rock()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 147 + x * 24):
for yi in range(3 + y * 24, 102 + y * 24):
self.maze[xi, yi] = 1
def make_wall9(self):
X1 = [1, 2, 3, 5, 7, 10, 13, 17, 21, 22, 23]
Y1 = [3]
X2 = [2, 5, 7, 9, 11, 13, 14, 15, 17, 21]
Y2 = [4]
X3 = [2, 5, 7, 9, 11, 13, 15, 17, 18, 19, 21]
Y3 = [5]
X4 = [2, 5, 6, 7, 9, 10, 11, 13, 15, 17, 19, 21, 22, 23]
Y4 = [6]
X5 = [2, 5, 7, 9, 11, 13, 15, 17, 18, 19, 23]
Y5 = [7]
X6 = [2, 5, 7, 9, 11, 13, 15, 17, 18, 23]
Y6 = [8]
X7 = [2, 5, 7, 9, 11, 13, 15, 17, 19, 21, 22, 23]
Y7 = [9]
X11 = [1, 2, 3, 5, 7, 10, 13, 17, 21, 22, 23]
Y11 = [15]
X21 = [2, 5, 7, 9, 11, 13, 14, 15, 17, 21]
Y21 = [16]
X31 = [2, 5, 7, 9, 11, 13, 15, 17, 18, 19, 21]
Y31 = [17]
X41 = [2, 5, 6, 7, 9, 10, 11, 13, 15, 17, 19, 21, 22, 23]
Y41 = [18]
X51 = [2, 5, 7, 9, 11, 13, 15, 17, 18, 19, 23]
Y51 = [19]
X61 = [2, 5, 7, 9, 11, 13, 15, 17, 18, 23]
Y61 = [20]
X71 = [2, 5, 7, 9, 11, 13, 15, 17, 19, 21, 22, 23]
Y71 = [21]
for x in X1:
for y in Y1:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X2:
for y in Y2:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X3:
for y in Y3:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X4:
for y in Y4:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X5:
for y in Y5:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X6:
for y in Y6:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X7:
for y in Y7:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X11:
for y in Y11:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X21:
for y in Y21:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X31:
for y in Y31:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X41:
for y in Y41:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X51:
for y in Y51:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X61:
for y in Y61:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in X71:
for y in Y71:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
# Up wall no door
def up_no_door(self):
Xup = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
Yup = [0]
for y in Yup:
for x in Xup:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.block_maze[y, x] = 1
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
def up_has_door(self,door_num):
Xup = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
Yup = [0]
Xup_d = [11, 12, 13, 14]
Yup_d = [0]
for y in Yup:
for x in Xup:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.block_maze[y, x] = 1
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in Xup_d:
for y in Yup_d:
self.door = Up_Door()
self.door.rect.left, self.door.rect.top = 3 + x * 24, 3 + y * 24
self.doorGroup.append(self.door)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = door_num
def bottom_no_door(self):
Xbottom = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
Ybottom = [25]
for y in Ybottom:
for x in Xbottom:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.block_maze[y, x] = 1
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
def bottom_has_door(self, door_num):
Xbottom = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
Ybottom = [25]
Xbottom_d = [11, 12, 13, 14]
Ybottom_d = [25]
for x in Xbottom:
for y in Ybottom:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in Xbottom_d:
for y in Ybottom_d:
self.door = Down_Door()
self.door.rect.left, self.door.rect.top = 3 + x * 24, 3 + y * 24
self.doorGroup.append(self.door)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = door_num
def left_no_door(self):
Xleft = [0]
Yleft = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
for x in Xleft:
for y in Yleft:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
def left_special_door(self,door_num):
Xleft = [0]
Yleft = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
Xleft_d = [0]
Yleft_d = [10, 11, 12, 13]
for x in Xleft:
for y in Yleft:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in Xleft_d:
for y in Yleft_d:
self.door = Special_Door()
self.door.rect.left, self.door.rect.top = 3 + x * 24, 3 + y * 24
self.doorGroup.append(self.door)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = door_num
def left_has_door(self,door_num):
Xleft = [0]
Yleft = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
Xleft_d = [0]
Yleft_d = [10, 11, 12, 13]
for x in Xleft:
for y in Yleft:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in Xleft_d:
for y in Yleft_d:
self.door = Left_Door()
self.door.rect.left, self.door.rect.top = 3 + x * 24, 3 + y * 24
self.doorGroup.append(self.door)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = door_num
def right_no_door(self):
Xright = [25]
Yright = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
for x in Xright:
for y in Yright:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
def right_special_door(self, door_num):
Xright = [25]
Yright = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
Xright_d = [25]
Yright_d = [10, 11, 12, 13]
for x in Xright:
for y in Yright:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in Xright_d:
for y in Yright_d:
self.door = Special_Door()
self.door.rect.left, self.door.rect.top = 3 + x * 24, 3 + y * 24
self.doorGroup.append(self.door)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = door_num
def right_has_door(self, door_num):
Xright = [25]
Yright = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
Xright_d = [25]
Yright_d = [10, 11, 12, 13]
for x in Xright:
for y in Yright:
self.block = Blocks()
self.block.rect.left, self.block.rect.top = 3 + x * 24, 3 + y * 24
self.blockGroup.append(self.block)
self.block_maze[y, x] = 1
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = 1
for x in Xright_d:
for y in Yright_d:
self.door = Right_Door()
self.door.rect.left, self.door.rect.top = 3 + x * 24, 3 + y * 24
self.doorGroup.append(self.door)
for xi in range(3 + x * 24, 27 + x * 24):
for yi in range(3 + y * 24, 27 + y * 24):
self.maze[xi, yi] = door_num
def fill_door(self):
for i in range(self.block_maze.shape[0]):
for j in range(self.block_maze.shape[1]):
if i != 0 and i != self.block_maze.shape[0] - 1 and j != 0 and j != self.block_maze.shape[1] - 1 and \
self.block_maze[i][j] == 1:
self.block_maze[i - 1][j] = 1
self.block_maze[i][j - 1] = 1
class Map0:
def __init__(self):
self.small_x = 634
self.small_y = 76
init_para(self)
map2_para(self)
make_wall2(self)
right_no_door(self)
left_has_door(self, 35)
up_has_door(self,32)
bottom_has_door(self,10)
fill_door(self)
def dcrease_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map1():
def __init__(self):
self.small_x = 634
self.small_y = 100
init_para(self)
map3_para(self)
make_wall3(self)
left_special_door(self,33)
up_has_door(self, 9)
bottom_has_door(self, 11)
right_has_door(self, 12)
fill_door(self)
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
def damage_enemy(self, num):
self.enemy_number -= num
class Map2():
def __init__(self):
self.small_x = 634
self.small_y = 124
init_para(self)
map1_para(self)
make_wall1(self)
bottom_no_door(self)
left_no_door(self)
right_no_door(self)
# 地图三上门
up_has_door(self, 10)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map3():
def __init__(self):
self.small_x = 658
self.small_y = 100
init_para(self)
map4_para(self)
# 建墙
make_wall4(self)
up_no_door(self)
bottom_no_door(self)
#地图四左右门
left_has_door(self, 10)
right_has_door(self, 13)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map4():
def __init__(self):
self.small_x = 682
self.small_y = 100
init_para(self)
map4_para(self)
# 建墙
make_wall4(self)
right_no_door(self)
#地图五左上下门
left_has_door(self, 12)
up_has_door(self, 14)
bottom_has_door(self, 20)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map5():
def __init__(self):
self.small_x = 682
self.small_y = 76
init_para(self)
map2_para(self)
# 建墙
make_wall2(self)
left_no_door(self)
up_no_door(self)
# 地图六下右门
bottom_has_door(self, 13)
right_has_door(self, 15)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map6():
def __init__(self):
self.small_x = 706
self.small_y = 76
init_para(self)
map4_para(self)
# 建墙
make_wall4(self)
bottom_no_door(self)
up_no_door(self)
# 地图七左右门
left_has_door(self, 14)
right_has_door(self, 16)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map7():
def __init__(self):
self.small_x = 730
self.small_y = 76
init_para(self)
map3_para(self)
# 建墙
make_wall3(self)
right_no_door(self)
up_no_door(self)
# 地图八左下门
left_has_door(self, 15)
bottom_has_door(self, 17)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map8():
def __init__(self):
self.small_x = 730
self.small_y = 100
init_para(self)
map2_para(self)
# 建墙
make_wall2(self)
left_no_door(self)
right_no_door(self)
# 地图九上下门
bottom_has_door(self, 18)
up_has_door(self, 16)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map9():
def __init__(self):
self.small_x = 730
self.small_y = 124
init_para(self)
map1_para(self)
# 建墙
make_wall1(self)
right_no_door(self)
bottom_no_door(self)
# 地图十上右门
left_has_door(self, 19)
up_has_door(self,17)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map10():
def __init__(self):
self.small_x = 706
self.small_y = 124
init_para(self)
map3_para(self)
# 建墙
make_wall3(self)
up_no_door(self)
# 地图十一下左右
bottom_has_door(self, 22)
right_has_door(self, 18)
left_has_door(self, 20)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map11():
def __init__(self):
self.small_x = 682
self.small_y = 124
init_para(self)
map2_para(self)
# 建墙
make_wall2(self)
left_no_door(self)
# 地图十二上下右门
bottom_has_door(self, 21)
up_has_door(self,13)
right_has_door(self, 19)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map12():
def __init__(self):
self.small_x = 682
self.small_y = 148
init_para(self)
map4_para(self)
# 建墙
make_wall4(self)
# 地图十三上下左右门
bottom_has_door(self, 24)
right_has_door(self, 22)
up_has_door(self, 20)
left_has_door(self, 23)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map13():
def __init__(self):
self.small_x = 706
self.small_y = 148
init_para(self)
map3_para(self)
# 建墙
make_wall3(self)
right_no_door(self)
bottom_no_door(self)
# 地图十四左上门
left_has_door(self, 21)
up_has_door(self, 19)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map14():
def __init__(self):
self.small_x = 658
self.small_y = 148
init_para(self)
map2_para(self)
# 建墙
make_wall2(self)
up_no_door(self)
bottom_no_door(self)
left_no_door(self)
# 地图十五右门
right_has_door(self, 21)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map15():
def __init__(self):
self.small_x = 682
self.small_y = 172
init_para(self)
map3_para(self)
# 建墙
make_wall3(self)
left_no_door(self)
right_no_door(self)
# 地图十六上下门
bottom_has_door(self, 25)
up_has_door(self, 21)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map16():
def __init__(self):
self.small_x = 682
self.small_y = 196
init_para(self)
map4_para(self)
# 建墙
make_wall4(self)
bottom_no_door(self)
# 地图十七上左右门
right_has_door(self, 29)
up_has_door(self,24)
left_has_door(self, 26)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map17():
def __init__(self):
self.small_x = 658
self.small_y = 196
init_para(self)
map3_para(self)
# 建墙
make_wall3(self)
up_no_door(self)
bottom_no_door(self)
# 地图十八左右门
right_has_door(self, 25)
left_has_door(self, 27)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map18():
def __init__(self):
self.small_x = 634
self.small_y = 196
init_para(self)
map2_para(self)
# 建墙
make_wall2(self)
left_no_door(self)
bottom_no_door(self)
# 地图十九上右门
right_has_door(self, 26)
up_has_door(self,28)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map19():
def __init__(self):
self.small_x = 634
self.small_y = 172
init_para(self)
map2_para(self)
# 建墙
make_wall2(self)
left_no_door(self)
right_no_door(self)
# 地图二十上下门
bottom_has_door(self, 27)
up_has_door(self, 32)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map20():
def __init__(self):
self.small_x = 704
self.small_y = 196
init_para(self)
map3_para(self)
# 建墙
make_wall3(self)
up_no_door(self)
bottom_no_door(self)
# 地图二十一左右门
right_has_door(self, 30)
left_has_door(self, 25)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map21():
def __init__(self):
self.small_x = 730
self.small_y = 196
init_para(self)
map1_para(self)
# 建墙
make_wall1(self)
up_no_door(self)
right_no_door(self)
# 地图二十二左下门
bottom_has_door(self, 31)
left_has_door(self, 29)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map22():
def __init__(self):
self.small_x = 730
self.small_y = 220
init_para(self)
map2_para(self)
# 建墙
make_wall2(self)
left_no_door(self)
right_no_door(self)
# 地图二十三上下门
bottom_has_door(self, 32)
up_has_door(self, 30)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
class Map23():
#Boss 房间
def __init__(self):
self.small_x = 693
self.small_y = 560
init_para(self)
map5_para(self)
# 建墙
make_wall5(self)
right_no_door(self)
# boss房门
bottom_has_door(self, 28)
up_has_door(self, 31)
left_special_door(self, 36)
# 填充门
fill_door(self)
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
#减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
#加敌函数
def increase_enemy(self, num):
self.enemy_number += num
#隐藏地图
class Map24():
def __init__(self):
self.small_x = 689
self.small_y = 355
init_para(self)
map6_para(self)
self.steady_buff.append(Buff.BuffStuff(315, 315, 4))
# 建墙
make_wall6(self)
up_no_door(self)
bottom_no_door(self)
left_no_door(self)
# 隐藏关卡门
right_special_door(self, 10)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
#初始地图
class Map25():
def __init__(self):
self.small_x = 685
self.small_y = 355
self.enemy_number = 0
self.doorGroup = list()
self.traps = list()
self.enemies = list()
self.steady_buff = list()
self.blockGroup = list()
self.size = 24
self.maze = np.zeros(shape=(630, 630))
self.block_maze = np.zeros(shape=(26, 26)) # 缩小版的maze, 1 为 墙, 0 为 可通行区域
self.sound = pygame.mixer.Sound("sound/soundtrack/Eclipse.mp3")
self.sound.set_volume(0.4)
self.over = True
# 建墙
'''make_wall7(self)'''
up_no_door(self)
bottom_no_door(self)
left_no_door(self)
# 隐藏关卡门
right_has_door(self, 35)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
#走廊
class Map26():
def __init__(self):
self.small_x = 685
self.small_y = 370
self.enemy_number = 0
self.doorGroup = list()
self.traps = list()
self.enemies = list()
self.steady_buff = list()
self.blockGroup = list()
self.size = 24
self.maze = np.zeros(shape=(630, 630))
self.block_maze = np.zeros(shape=(26, 26)) # 缩小版的maze, 1 为 墙, 0 为 可通行区域
self.sound = pygame.mixer.Sound("sound/soundtrack/Eclipse.mp3")
self.sound.set_volume(0.4)
self.over = True
# 建墙
make_wall8(self)
up_no_door(self)
bottom_no_door(self)
# 走廊左右门
left_has_door(self, 34)
right_has_door(self, 9)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
#结束走廊
class Map27():
def __init__(self):
self.small_x = 685
self.small_y = 370
self.enemy_number = 0
self.doorGroup = list()
self.traps = list()
self.enemies = list()
self.steady_buff = list()
self.blockGroup = list()
self.size = 24
self.maze = np.zeros(shape=(630, 630))
self.block_maze = np.zeros(shape=(26, 26)) # 缩小版的maze, 1 为 墙, 0 为 可通行区域
self.sound = pygame.mixer.Sound("sound/soundtrack/Eclipse.mp3")
self.sound.set_volume(0.4)
self.over = True
# 建墙
make_wall9(self)
up_no_door(self)
bottom_no_door(self)
# 走廊左右门
left_has_door(self, 34)
right_has_door(self, 32)
# 填充门
fill_door(self)
# 减敌函数
def damage_enemy(self, num):
self.enemy_number -= num
def play_back(self):
self.sound.play(-1)
def stop_play(self):
self.sound.stop()
# 新添加---------------------------------------------------------------------------------
class Map28():
def __init__(self):
SmallMap(self)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化