def __init__(self, win, screen, sRGB=[], mX=0, mY=0): #| True/False | window | screen #Инициализация pygame.font.init() #Получаемые переменные self.screen0 = screen self.win0 = win self.sRGB = sRGB #Переменные self.mX = self.mY = 0 #Кнопочки self.button_start = graph.Sprite(720, 560, 'sprites/buttons.png', (0, 0, 75, 36)) self.fontStart = pygame.font.Font('fonts/STIXGeneral-Bold.otf', 14) self.button_exit = graph.Sprite(643, 560, 'sprites/buttons.png', (76, 0, 75, 36)) self.fontExit = pygame.font.Font('fonts/STIXGeneral-Bold.otf', 14) #Независимые надписи self.fontCompany = pygame.font.Font('fonts/STIXGeneral-Bold.otf', 18) self.fontTitle = pygame.font.Font('fonts/STIXGeneral-Bold.otf', 40) self.fontVer = pygame.font.Font('fonts/STIXGeneral-Bold.otf', 18) #Курсор self.cursor = pygame.cursors.load_xbm('sprites/crs.xbm', 'sprites/crs.xbm') pygame.mouse.set_cursor(*self.cursor) self.pngCursor = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (32, 320, 32, 32)) #Фон self.background = graph.Sprite(0, 0, 'sprites/title.png', (0, 0, 800, 600))
def __init__(self,win,screen,sRGB = [],mX=0,mY=0): #Получаемые переменные self.screen0 = screen self.win0 = win self.sRGB = sRGB self.scX = 0 self.scY = 0 self.mX = mX self.mY = mY #Героиня self.nanami = hero.hero(400,300,'sprites/nana.png',(0,0,32,56)) self.nanami.DownAnimate() #Позиция гороини от левого верхнего угла self.nanami.xpos = 257 self.nanami.ypos = 372 #Позиция ног Нанами self.nanami.gX = self.nanami.xpos - 16 self.nanami.gY = self.nanami.ypos - 53 #Булеан переменные говорящие Нанами о том что нужно идти self.nanami.down_step = False self.nanami.up_step = False self.nanami.left_step = False self.nanami.right_step = False #Определитель нажатия self.KeyDownMap = 0 #Отрисовка комнаты (слои) self.room = graph.Sprite(0,0,'sprites/level0.png',(0,0,800,600)) self.roomFront = graph.Sprite(0,0,'sprites/level0_yt.png',(0,0,800,600)) #Курсор self.pngCursor = graph.Sprite(0,0,'sprites/town_forest_tiles.png' ,(32,320,32,32)) #Допустим попытка номер 1 - список непроходимостей self.StopListDown = [[166,229,202,280,250,0], #x1 Example: if ((x > x1) and (x < x2)) [202,247,228,600,280,166], #x2 : [274,341,320,274,285,211], #y1 and ((y < y1) and (y < y2)) [274,341,320,274,285,211]] #y2 : self.StopListLeft = [[205,235,175,140,175], # Example if ((x > x1) and (x > x2)) [205,235,175,140,175], # : [279,328,214,185,103], # and ((y > y1) and (y < y2)) [328,350,281,214,185]] self.StopListRight = [[244,600,442,600,280], #Example if ((x < x1) and (x < x2)) [244,600,442,600,280], # : [286,103,141,235,274], # and ((y > y1) and (y < y2)) [341,142,235,275,287]] # : self.StopListUp = [[175,358,405], #x1 Example if ((x>=x1) and (x<=x2)) [359,406,600], #x2 : [113,50,113], #y1 and ((y<=y1) and (y<=y2)) [113,50,113]] #y2 :
def __init__(self, xpos, ypos, filename, kadrXYWH=[]): self.filename = filename self.kadrXYWH = kadrXYWH self.x = xpos self.y = ypos self.animPlus = 4 self.name = 'Nanami' self.brushHero = graph.Sprite(0, 0, self.filename, (self.kadrXYWH[0], self.kadrXYWH[1], self.kadrXYWH[2], self.kadrXYWH[3])) self.mFPS = 0
def DownAnimate(self): if ((self.mFPS >= 0) and (self.mFPS < self.animPlus)): self.brushHero = None self.brushHero = graph.Sprite(0, 0, self.filename, (self.kadrXYWH[0], self.kadrXYWH[1], self.kadrXYWH[2], self.kadrXYWH[3])) elif (self.mFPS == self.animPlus): self.brushHero = None self.brushHero = graph.Sprite( 0, 0, self.filename, (self.kadrXYWH[0], self.kadrXYWH[1] + 56, self.kadrXYWH[2], self.kadrXYWH[3])) elif (self.mFPS == self.animPlus * 2): self.brushHero = None self.brushHero = graph.Sprite( 0, 0, self.filename, (self.kadrXYWH[0], self.kadrXYWH[1] + 112, self.kadrXYWH[2], self.kadrXYWH[3])) elif (self.mFPS == self.animPlus * 3): self.brushHero = None self.brushHero = graph.Sprite( 0, 0, self.filename, (self.kadrXYWH[0], self.kadrXYWH[1] + 168, self.kadrXYWH[2], self.kadrXYWH[3]))
def __init__(self, run, win, screen, mX, mY): #Инициализация pygame.font.init() #Получаемые переменные self.screen0 = screen self.win0 = win self.run0 = run self.mX = mX self.mY = mY #Переменные self.mX = self.mY = 0 #Позиция мыши self.sX = self.sY = 0 #Позиция игрового экрана #Объекты self.fonGameMenu = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (0, 0, 32, 32)) #Книга (стилистика меню) self.bookStyle = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (0, 384, 672 + 64, 490)) #фон self.Background = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (0, 896, 800, 600))
def __init__(self, gamePanel, HP, MP): self.gamePanel = gamePanel self.fonGamePanel = graph.Sprite(0, 0, 'sprites/gamepanel.png', (0, 0, 800, 48)) #Кнопочки self.buttonExit = graph.Sprite(0, 0, 'sprites/buttons.png', (152, 0, 53, 37)) self.buttonExit0 = graph.Sprite(0, 0, 'sprites/buttons.png', (152, 37, 53, 37)) #Шрифты self.HPFont = pygame.font.Font('fonts/STIXGeneral-Bold.otf', 12) self.MPFont = pygame.font.Font('fonts/STIXGeneral-Bold.otf', 12) self.fontExit = pygame.font.Font('fonts/STIXGeneral-Bold.otf', 16) #Жизнь self.HPStart = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (160, 289, 3, 16)) self.HPMiddle = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (164, 289, 2, 16)) self.HPEnd = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (172, 289, 3, 16)) #Мана self.MPStart = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (160, 289 + 16, 3, 16)) self.MPMiddle = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (164, 289 + 16, 2, 16)) self.MPEnd = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (172, 289 + 16, 3, 16)) self.gamePanel = gamePanel self.HP = HP self.MP = MP #Курсор self.pngCursor = graph.Sprite(0, 0, 'sprites/town_forest_tiles.png', (32, 320, 32, 32)) self.mX = 0 self.mY = 0
def button_exit_inactive(self): self.button_exit = graph.Sprite(643, 560, 'sprites/buttons.png', (76, 0, 75, 36))
def button_start_inactive(self): self.button_start = graph.Sprite(720, 560, 'sprites/buttons.png', (0, 0, 75, 36))
def DownStop(self): self.brushHero = None self.brushHero = graph.Sprite(0, 0, self.filename, (self.kadrXYWH[0], self.kadrXYWH[1], self.kadrXYWH[2], self.kadrXYWH[3]))