def __init__(self, win): self.win = win self.superImg = pygame.image.load(dataName('super.png')) self.bomb = effects.Bomb(self.win, pos=(640, 140), finalPos=(180, 140), rot=-102) self.bomb.totalTime = -1 self.explosion = effects.Explosion(self.win, (80, 50)) self.superPause = 1000 self.superPauseTimer = self.superPause self.xSpeed = 15 self.ySpeed = 15 self.finalPos = (40, 80) self.pos = (-200, 80) self.ft = pygame.font.Font(dataName('Galatican.ttf'), 86) self.titleText = pygame.Surface((448, 100)).convert_alpha() self.titleText.fill((0, 0, 0, 0)) # blit the images twice to get the offsets correct self.titleText.blit(self.ft.render("MBITRON", True, (0, 0, 0)), (113, 0)) self.titleText.blit(self.ft.render("B", True, (0, 0, 0)), (0, 0)) self.active = True
def __init__(self, win): self.win = win self.backArrow = pygame.image.load(dataName('back-arrow.png')) self.forwardArrow = pygame.image.load(dataName('forward-arrow.png')) self.backRedArrow = pygame.image.load(dataName('back-red-arrow.png')) self.forwardRedArrow = \ pygame.image.load(dataName('forward-red-arrow.png')) self.backImage = self.backArrow self.forwardImage = self.forwardArrow self.backRect = self.backArrow.get_rect() self.forwardRect = self.forwardArrow.get_rect() self.currentLevel = 0 self.reset()
import sys import pygame import random import effects import bombs import levels from bombs import dataName TILE_IMG = pygame.image.load(dataName('tile.png')) AWESOME_FONT = pygame.font.Font(dataName('badabb__.ttf'), 70) AWESOME_FONT_SM = pygame.font.Font(dataName('badabb__.ttf'), 30) ESC_TEXT = AWESOME_FONT_SM.render("Press 'ESC' to Quit", True, (0, 0, 0)) TEXT_RECT_POS = (180, 270) BACK_RECT_POS = (345, 290) FORWARD_RECT_POS = (455, 290) PLAY_RECT_POS = (320, 230) NEWGAME_RECT_POS = (320, 385) ESC_RECT_POS = (212, 420) class TitleBackground: def __init__(self, win): self.win = win self.tiles = [effects.SpinTile(self.win)] self.tileAppendSpeed = 500