def incrementScore(self, value, textPosition, textGroup): if self.comboBonus and value <= 250: self.comboBonus += int(.2 * FRAMES_PER_SECOND) self.comboKills += 1 tempImage = text.Text(FONT_PATH, 30, FONT_COLOR, "x" + str(self.comboKills) + "!").image helpBubble = infoBubble.infoBubble(tempImage, self,0.5 * FRAMES_PER_SECOND) helpBubble.offSet = vector.vector2d(0.0, -100.0) self.bulletGroup.add(helpBubble) if self.pointBonus: value *= 2 tempText = text.Text(FONT_PATH, 36, FONT_COLOR, str(value), 15) tempText.setAlign(CENTER_MIDDLE) tempText.position = vector.vector2d(textPosition) textGroup.add(tempText) self.score += value self.scoreBoard.setText(self.score) if self.score >= self.nextBonus: utility.playSound(self.extraLifeSound, OW_CHANNEL) tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Extra Life!").image helpBubble = infoBubble.infoBubble(tempImage, self,1.5 * FRAMES_PER_SECOND) helpBubble.offSet = vector.vector2d(0.0, -100.0) textGroup.add(helpBubble) self.lives += 1 self.lifeBoard.setText('x' + str(self.lives)) self.nextBonus += 50000
def collide(self): if self.objectCollidedWith.actorType == ACTOR_TYPE_BOSS: self.objectCollidedWith.bulletCollide(self) elif self.collideStyle == COLLIDE_STYLE_HURT: if self.objectCollidedWith.actorType == ACTOR_TYPE_ENEMY: self.objectCollidedWith.health -= self.damage self.die() elif self.collideStyle == COLLIDE_STYLE_REFLECT: if self.objectCollidedWith.actorType == ACTOR_TYPE_BAAKE: if self.position.x < self.objectCollidedWith.position.x - 64: self.position = vector.vector2d(self.objectCollidedWith.position.x - 104,self.position.y) self.velocity *= [-1.0, 1.0] elif self.position.x > self.objectCollidedWith.position.x + 64: self.position = vector.vector2d(self.objectCollidedWith.position.x + 104,self.position.y) self.velocity *= [-1.0, 1.0] if self.position.y < self.objectCollidedWith.position.y - 32: self.position = vector.vector2d(self.position.x, self.objectCollidedWith.position.y - 104) self.velocity *= [1.0, -1.0] elif self.position.y > self.objectCollidedWith.position.y + 32: self.position = vector.vector2d(self.position.x, self.objectCollidedWith.position.y + 104) self.velocity *= [1.0, -1.0] else: self.objectCollidedWith.health -= self.damage self.die() elif self.collideStyle == COLLIDE_STYLE_NOVA: if self.objectCollidedWith.actorType == ACTOR_TYPE_ENEMY: self.objectCollidedWith.health = 0 elif self.collideStyle == COLLIDE_STYLE_NONE: pass
def customBounds(self): if self.position.y < self.bounds[TOP] or self.position.y > self.bounds[BOTTOM]: self.offSet *= -1 self.createBubble() if self.position.x < self.bounds[LEFT]: self.position = vector.vector2d(self.bounds[LEFT],self.position.y) elif self.position.x > self.bounds[RIGHT]: self.position = vector.vector2d(self.bounds[RIGHT],self.position.y)
def customBounds(self): if self.position.x < 20.0: self.position = vector.vector2d(20.0,self.position.y) if self.position.y < 20.0: self.position = vector.vector2d(self.position.x, 20.0) if self.position.x > SCREEN_WIDTH - 20.0: self.position = vector.vector2d(SCREEN_WIDTH - 20.0,self.position.y) if self.position.y > SCREEN_HEIGHT - 20.0: self.position = vector.vector2d(self.position.x, SCREEN_HEIGHT - 20.0)
def cardinalDirection(object): if (int(random.random() * 2 + 1) - 1): if (int(random.random() * 2 + 1) - 1): object.velocity = vector.vector2d(object.speed,0.0) else: object.velocity = vector.vector2d(-object.speed, 0.0) else: if (int(random.random() * 2 + 1) - 1): object.velocity = vector.vector2d(0.0, object.speed) else: object.velocity = vector.vector2d(0.0, -object.speed)
def actorUpdate(self): if self.lives <= 0: self.active = False self.velocity -= vector.vector2d(0.0,-0.3) self.die() return if not self.damageBonus: self.bulletDamage = 1 if not self.reflectBonus: self.bulletBoundStyle = BOUND_STYLE_KILL self.bulletCollideStyle = COLLIDE_STYLE_HURT if not self.fastShot: self.resetFireTimer = self.defaultFireTimer if self.pointBonus: self.pointBonus -= 1 if self.damageBonus: self.damageBonus -= 1 if self.reflectBonus: self.reflectBonus -= 1 if self.duelShot: self.duelShot -= 1 if self.stunTimer: self.stunTimer -= 1 if self.fastShot: self.fastShot -= 1 if self.comboBonus: self.comboBonus -= 1 if not self.comboBonus: comboCounter = 0 bonusPoints = 0 while comboCounter <= self.comboKills: comboCounter += 1 bonusPoints += comboCounter * 25 self.incrementScoreNoText(bonusPoints) tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Combo Points:" + str(bonusPoints) + "!").image helpBubble = infoBubble.infoBubble(tempImage, self,1.5 * FRAMES_PER_SECOND) helpBubble.offSet = vector.vector2d(0.0, -100.0) self.bulletGroup.add(helpBubble) self.comboKills = 0 self.fireTimer -= 1 self.velocity *= .95 if not self.active: self.active = True if not self.fireTimer: self.animationList.stop("Idle", self.animationList.currentFrame) if self.stunTimer: self.animationList.play("HurtIdle", self.animationList.currentFrame)
def pointOffScreen(distance = 32): screenSide = int(random.random() * 3 + 1) - 1 if screenSide == LEFT: point = vector.vector2d(-distance,random.random() * SCREEN_HEIGHT) elif screenSide == TOP: point = vector.vector2d(random.random() * SCREEN_WIDTH,-distance) elif screenSide == RIGHT: point = vector.vector2d(SCREEN_WIDTH + distance,random.random() * SCREEN_HEIGHT) elif screenSide == BOTTOM: point = vector.vector2d(random.random() * SCREEN_WIDTH, SCREEN_HEIGHT + distance) return point
def __init__(self, screen, musicList, backgroundImage, bounds, title, menuDictionary, startSelection = 0): self.screen = screen self.bounds = bounds self.menuDictionary = menuDictionary self.title = title self.musicList = musicList self.backgroundImage = backgroundImage self.cursor = Cursor() pygame.mouse.set_visible(False) self.menuGroup = pygame.sprite.Group() self.menuTooltipGroup = pygame.sprite.Group() self.cursorGroup = pygame.sprite.Group() self.menuSelectionPointer = [] self.menuTooltipPointer = [] self.currentSelection = startSelection self.timer = pygame.time.Clock() self.menuBeep = utility.loadSound("menuBeep") self.menuForward = utility.loadSound("menuForward") self.menuBack = utility.loadSound("menuBack") index = 0 menuTitle = text.Text(FONT_PATH, title[1], FONT_COLOR, title[0]) menuTitle.position = vector.vector2d(title[2],title[3]) menuTitle.setAlign(CENTER_MIDDLE) self.menuGroup.add(menuTitle) for option in menuDictionary: menuSelection = text.Text(FONT_PATH, 32, FONT_INACTIVE_COLOR, menuDictionary[option][0],-1,index) menuSelection.setAlign(CENTER_MIDDLE) menuSelection.position = vector.vector2d((((self.bounds[RIGHT]-self.bounds[LEFT]) / 2)+self.bounds[LEFT], ((self.bounds[BOTTOM]-self.bounds[TOP]) / (len(self.menuDictionary)+1)*(index + 1))+self.bounds[TOP])) self.menuGroup.add(menuSelection) self.menuSelectionPointer.append(menuSelection) menuTooltip = text.Text(FONT_PATH, 32, FONT_COLOR, menuDictionary[option][1]) menuTooltip.setAlign(BOTTOM_MIDDLE) menuTooltip.position = vector.vector2d(((SCREEN_WIDTH / 2),SCREEN_HEIGHT)) self.menuTooltipGroup.add(menuTooltip) self.menuTooltipPointer.append(menuTooltip) index += 1 self.cursorGroup.add(self.cursor)
def spawnOffScreen(object, distance = 32): screenSide = int(random.random() * 3 + 1) - 1 if screenSide == LEFT: object.position = vector.vector2d(-distance,random.random() * SCREEN_HEIGHT) elif screenSide == TOP: object.position = vector.vector2d(random.random() * SCREEN_WIDTH,-distance) elif screenSide == RIGHT: object.position = vector.vector2d(SCREEN_WIDTH + distance,random.random() * SCREEN_HEIGHT) elif screenSide == BOTTOM: object.position = vector.vector2d(random.random() * SCREEN_WIDTH, SCREEN_HEIGHT + distance)
def die(self): if self.dying == 0: deathType = int(random.random() * 3) #print deathType if deathType == 0: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Blast!").image utility.playSound(self.deathSound[0], OW_CHANNEL) elif deathType == 1: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Oh No!").image utility.playSound(self.deathSound[1], OW_CHANNEL) elif deathType == 2: tempImage = text.TextSurface(FONT_PATH, 30,FONT_COLOR, "Bother!").image utility.playSound(self.deathSound[2], OW_CHANNEL) self.animationList.play("Die") self.bounds = [-1000, -1000, SCREEN_WIDTH + 1000, SCREEN_HEIGHT + 32] self.boundStyle = BOUND_STYLE_CUSTOM helpBubble = infoBubble.infoBubble(tempImage, self, 5 * FRAMES_PER_SECOND) helpBubble.offSet = vector.vector2d(0.0, -100.0) self.bulletGroup.add(helpBubble) self.dying += 1 if settingList[PARTICLES] and not self.dying % 2: puffsToCreate = 4 while puffsToCreate: puffsToCreate -= 1 tempPuff = particle.smokeParticle(self.position, [1,0]) tempPuff.velocity.setAngle(359 * random.random()) self.effectsGroup.add(tempPuff)
def __init__(self, bulletGroup, effectsGroup, lifeBoard, scoreBoard): """ COMMON VARIABLES """ actor.Actor.__init__(self) self.actorType = ACTOR_PLAYER self.animationList = copy.copy(self.MasterAnimationList) self.animationList.setParent(self) self.animationList.play("Idle") self.rect = self.image.get_rect() self.boundStyle = BOUND_STYLE_REFLECT self.bounds = [0 + 46,0 + 60,SCREEN_WIDTH - 46,SCREEN_HEIGHT - 32] self.canCollide = True self.hitrect = pygame.Rect(0,0,80,90) self.position = vector.vector2d((SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4)) self.velocity = vector.vector2d.zero """ UNIQUE VARIABLES """ self.bulletSpeed = BULLET_SPEED self.defaultFireTimer = 2 self.resetFireTimer = self.defaultFireTimer self.fireTimer = self.resetFireTimer self.maxSpeed = 54 self.hitrectOffsetY = -15 self.score = 0 self.lives = 3 self.stunTimer = 0 self.lifeBoard = lifeBoard self.scoreBoard = scoreBoard self.lifeBoard.setText('x' + str(self.lives)) self.scoreBoard.setText(self.score) self.nextBonus = 50000 self.dying = 0 self.dead = False """ BONUS VARIABLES """ self.damageBonus = 0 self.reflectBonus = 0 self.duelShot = 0 self.fastShot = 0 self.pointBonus = 0 self.comboBonus = 0 self.comboKills = 0 """ BULLET VARIABLES """ self.bulletDamage = 1 self.bulletBoundStyle = BOUND_STYLE_KILL self.bulletCollideStyle = COLLIDE_STYLE_HURT self.bulletGroup = bulletGroup self.effectsGroup = effectsGroup """ SOUND VARIABLES """ self.currentSound = 0
def fire(self): if self.stunTimer: self.animationList.play("HurtFire", self.animationList.currentFrame) else: self.animationList.play("Fire") if (self.fireTimer <= 0): utility.playSound(self.fireSound[random.randint(0,2)],PLAYER_CHANNEL) if self.velocity: bulletVelocity = vector.vector2d(self.velocity) bulletVelocity.setMagnitude(self.bulletSpeed) newBullet = bullet.Bullet((self.position), (bulletVelocity), self.effectsGroup, self.bulletDamage, self.bulletBoundStyle, self.bulletCollideStyle) newBullet.setOwner(self) if self.reflectBonus and self.damageBonus: newBullet.animationList.play("DamageReflect") elif self.bulletCollideStyle == COLLIDE_STYLE_REFLECT: newBullet.animationList.play("Reflect") elif self.bulletDamage > 1: newBullet.animationList.play("Damage") self.bulletGroup.add(newBullet) self.fireTimer = self.resetFireTimer if self.duelShot: if self.velocity: bulletVelocity = vector.vector2d(self.velocity * -1) bulletVelocity.setMagnitude(self.bulletSpeed) newBullet = bullet.Bullet((self.position), (bulletVelocity), self.effectsGroup, self.bulletDamage, self.bulletBoundStyle, self.bulletCollideStyle) newBullet.setOwner(self) if self.reflectBonus and self.damageBonus: newBullet.animationList.play("DamageReflect") elif self.bulletCollideStyle == COLLIDE_STYLE_REFLECT: newBullet.animationList.play("Reflect") elif self.bulletDamage > 1: newBullet.animationList.play("Damage") self.bulletGroup.add(newBullet)
def actorUpdate(self): if self.lifeTimer: if self.mounted: self.position = self.target.position + self.offSet + vector.vector2d(self.target.hitrectOffsetX,self.target.hitrectOffsetY) self.lifeTimer -= 1 if not self.lifeTimer: self.die()
def die(self): if self.objectCollidedWith.actorType == ACTOR_PLAYER: self.objectCollidedWith.comboBonus += 5 * FRAMES_PER_SECOND tempImage = text.Text(FONT_PATH, 30, FONT_COLOR, "Combo Time!", 1).image helpBubble = infoBubble.infoBubble(tempImage, self.objectCollidedWith, 1.5 * FRAMES_PER_SECOND) helpBubble.offSet = vector.vector2d(0.0, -100.0) self.textGroup.add(helpBubble) self.active = False self.kill() del self
def spawnAwayFromTarget(object, target, distance = 256): check = False while not check: object.position = vector.vector2d((random.random() * object.bounds[RIGHT]), (random.random() * object.bounds[BOTTOM])) check = True checkDistance = object.position - target.position if checkDistance.getMagnitude() < distance: check = False
def __init__(self, position, textGroup): Balloon.__init__(self) self.animationList = copy.copy(self.MasterAnimationList) self.animationList.setParent(self) self.animationList.play("Idle") self.rect = self.image.get_rect() self.hitrect = pygame.Rect(0, 0, 60, 60) self.hitrectOffsetY = -5 self.textGroup = textGroup self.position = vector.vector2d(position)
def __init__(self, position, velocity): actor.Actor.__init__(self) self.animationList = copy.copy(self.MasterAnimationList) self.animationList.setParent(self) self.animationList.play("Idle") self.rect = self.image.get_rect() self.canCollide = False self.boundStyle = BOUND_STYLE_KILL self.bounds = [0,0,SCREEN_WIDTH,SCREEN_HEIGHT] self.position = vector.vector2d(position) self.velocity = vector.vector2d(velocity) self.lifeTimer = int(.5 * FRAMES_PER_SECOND) self.speed = 3 self.velocity.setMagnitude(self.speed)
def __init__(self, targetObject, groupList): """ COMMON VARIABLES """ enemy.Enemy.__init__(self) """ Rokubi Spawning """ self.noSpawn = False self.actorType = ACTOR_TYPE_ENEMY self.animationList = copy.copy(self.MasterAnimationList) self.animationList.setParent(self) self.animationList.play("Idle") self.rect = self.image.get_rect() self.boundStyle = BOUND_STYLE_NONE self.bounds = [-32,-32,(SCREEN_WIDTH + 32),(SCREEN_HEIGHT + 32)] self.canCollide = True self.hitrect = pygame.Rect(0,0,54,98) self.velocity = vector.vector2d(0,0) """ UNIQUE VARIABLES """ self.speed = 7 self.hideBehind = targetObject self.target = targetObject self.powerupGroup = groupList[POWERUP_GROUP] self.enemyGroup = groupList[ENEMY_GROUP] self.textGroup = groupList[TEXT_GROUP] self.effectsGroup = groupList[EFFECTS_GROUP] self.bossGroup = groupList[BOSS_GROUP] self.health = 1 self.dropItem = False self.bossFight = False self.charging = False self.hiding = False self.emitter = particle.particleEmitter(vector.vector2d.zero,vector.vector2d.zero, self.effectsGroup, ["heart"], 270.0,45.0, 0.0,0.0, 8.0,1.0, -1.0) self.emitter.mountTo(self) aitools.spawnOffScreen(self)
def __init__(self, position, velocity, effectsGroup, damage = 1, defaultBoundStyle = BOUND_STYLE_KILL, defaultCollideStyle = COLLIDE_STYLE_HURT): """ COMMON VARIABLES """ actor.Actor.__init__(self) self.actorType = ACTOR_BULLET self.animationList = copy.copy(self.MasterAnimationList) self.animationList.setParent(self) self.animationList.play("Idle") self.rect = self.image.get_rect() if defaultCollideStyle == COLLIDE_STYLE_NOVA: self.boundStyle = BOUND_STYLE_NONE else: self.boundStyle = defaultBoundStyle self.bounds = [-32,-32,SCREEN_WIDTH + 32,SCREEN_HEIGHT + 32] self.canCollide = False self.hitrect = self.rect self.position = vector.vector2d(position) self.velocity = vector.vector2d(velocity) self.effectsGroup = effectsGroup self.owner = self """ UNIQUE VARIABLES """ self.collideStyle = defaultCollideStyle self.damage = damage self.lifeTimer = 2 * FRAMES_PER_SECOND self.sequenceList = [[0,1,2,3,4,5],[0]]
def __init__(self, pos, vel, mass): self.radius = mass * 5 self.colour = yellow self.pos_x = pos[0] self.pos_y = pos[1] self.vel_x = vel[0] self.vel_y = vel[1] self.mass = mass self.theta = 0 self.velocity_vector = vector.vector2d(self.vel_x, self.vel_y, self.theta) self.update_vector()
def __init__(self, imageFile): actor.Actor.__init__(self) self.animationList = animation.Animation() self.animationList.buildAnimation("Idle", [imageFile]) self.animationList.setParent(self) self.animationList.play("Idle") self.rect = self.image.get_rect() self.position = vector.vector2d(26,68) self.velocity = vector.vector2d.zero self.bounds = [0,0,SCREEN_WIDTH,SCREEN_HEIGHT]
def actorUpdate(self): self.active = True if self.moveRight: self.wave -= 1 if self.wave < -0.20 * FRAMES_PER_SECOND: self.moveRight = False else: self.wave += 1 if self.wave > FRAMES_PER_SECOND: self.moveRight = True self.XMovement = (self.wave / (FRAMES_PER_SECOND)) * 1.5 self.velocity = vector.vector2d(self.XMovement, -3)
def incrementScoreNoText(self,value): self.score += value self.scoreBoard.setText(self.score) if self.score > self.nextBonus: utility.playSound(self.extraLifeSound, OW_CHANNEL) tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Extra Life!").image helpBubble = infoBubble.infoBubble(tempImage, self,1.5 * FRAMES_PER_SECOND) helpBubble.offSet = vector.vector2d(0.0, -100.0) self.effectsGroup.add(helpBubble) self.lives += 1 self.lifeBoard.setText('x' + str(self.lives)) self.nextBonus += 50000
def outOfBounds(self): if self.boundStyle == BOUND_STYLE_CLAMP: if self.position.x < self.bounds[LEFT]: self.position = vector.vector2d(self.bounds[LEFT],self.position.y) elif self.position.x > self.bounds[RIGHT]: self.position = vector.vector2d(self.bounds[RIGHT],self.position.y) if self.position.y < self.bounds[TOP]: self.position = vector.vector2d(self.position.x, self.bounds[TOP]) elif self.position.y > self.bounds[BOTTOM]: self.position = vector.vector2d(self.position.x, self.bounds[BOTTOM]) elif self.boundStyle == BOUND_STYLE_WRAP: if self.position.x < self.bounds[LEFT]: self.position = vector.vector2d(self.bounds[RIGHT],self.position.y) elif self.position.x > self.bounds[RIGHT]: self.position = (self.bounds[LEFT],self.position.y) if self.position.y < self.bounds[TOP]: self.position = (self.position.x, self.bounds[BOTTOM]) elif self.position.y > self.bounds[BOTTOM]: self.position = (self.position.x, self.bounds[TOP]) elif self.boundStyle == BOUND_STYLE_REFLECT: if self.position.x < self.bounds[LEFT]: self.position = vector.vector2d(self.bounds[LEFT],self.position.y) self.velocity *= [-1.0, 1.0] elif self.position.x > self.bounds[RIGHT]: self.position = vector.vector2d(self.bounds[RIGHT],self.position.y) self.velocity *= [-1.0, 1.0] if self.position.y < self.bounds[TOP]: self.position = vector.vector2d(self.position.x, self.bounds[TOP]) self.velocity *= [1.0, -1.0] elif self.position.y > self.bounds[BOTTOM]: self.position = vector.vector2d(self.position.x, self.bounds[BOTTOM]) self.velocity *= [1.0, -1.0] elif self.boundStyle == BOUND_STYLE_KILL: self.kill() elif self.boundStyle == BOUND_STYLE_CUSTOM: self.customBounds()
def __init__(self, position, textGroup): Gem.__init__(self) """ COMMON VARIABLES """ self.animationList = copy.copy(self.MasterAnimationList) self.animationList.setParent(self) self.animationList.play("Idle") self.rect = self.image.get_rect() self.hitrect = self.rect self.position = vector.vector2d(position) self.velocity = vector.vector2d.zero """ UNIQUE VARIABLES """ self.textGroup = textGroup
def __init__(self, fontType, fontSize=12, color=(0, 0, 0), text="", lifeTimer=-1, textIndex=0): pygame.sprite.Sprite.__init__(self) pygame.font.init() self.textIndex = textIndex self.text = text self.color = color self.fontType = fontType # if hasattr(sys, '_MEIPASS'): self.fontType = utility.getResourcePath(fontType) self.fontSize = fontSize self.lifeTimer = lifeTimer self.alignment = TOP_LEFT self.buildImage() self.position = vector.vector2d(0, 0)
import time import random import math import vector import numpy as np # globals radius = 20 window_width = 800 window_height = 800 num_of_objects = 3 start_pos = (window_width / 2, radius + 5) gravity = 0 # meters / sec ^2 fps = 120 scale = 30 horizontal_vector = vector.vector2d(-40, 0, 0) # predefined colours white = (255, 255, 255) black = (0, 0, 0) red = (255, 0, 0) green = (0, 200, 0) blue = (0, 0, 255) bright_green = (0, 255, 0) yellow = (255, 255, 0) pg.init() dis = pg.display.set_mode((window_width, window_height)) pg.display.set_caption("phy") fpsclk = pg.time.Clock() ptime = 0
def spawnAtPoint(object, point): object.position = vector.vector2d(point)
def spawnOnScreen(object): object.position = vector.vector2d(((random.random() * (object.bounds[RIGHT] - object.bounds[LEFT])) + object.bounds[LEFT]), ((random.random() * (object.bounds[BOTTOM]- object.bounds[TOP])) + object.bounds[TOP]))
def displayText(self): tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Double Damage!").image helpBubble = infoBubble.infoBubble(tempImage, self.objectCollidedWith,1.5 * FRAMES_PER_SECOND) helpBubble.offSet = vector.vector2d(0.0, -100.0) self.textGroup.add(helpBubble)
def __init__(self, position, particleGroup): self.particleGroup = particleGroup self.position = vector.vector2d(position)
def update(self): if self.bossDead: self.timeAfterBoss += 1 if self.defaultSpawnRate: if not self.moonoSpawnRate: self.moonoSpawnRate = self.defaultSpawnRate self.spawnMoono() self.moonoSpawnRate -= 1 if self.newMoono.health <= 0: self.moonoDead = True if self.currentStep == 0: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Welcome to the tutorial!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.currentStep += 1 self.timer = 0 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 1: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Use your mouse to move.").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 5 * FRAMES_PER_SECOND and self.currentStep == 2: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Notice the stars that you shoot?").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 3: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "When moving you shoot stars.").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 4: self.spawnMoono("balloon") tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Oh no! Its a Moono!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 5: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Attack with your stars!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 6: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Moonos hurt you when they touch you.").image self.timer -= 1 self.moonoDead = False helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 7: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Did you get the Balloon?").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 8: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Collect balloons for bonus points!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 9: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Balloons always help you get more points.").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 10: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Points are important!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 11: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Every 50,000 points you get an extra life!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 12: self.spawnBaake() tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Oh bother! It's Baake.").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 13: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Baakes don't hurt you...").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 14: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "...but they do love to get in the way!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 15: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Its usually best to stay away from Baake.").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 16: self.spawnMoono("reflect") tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Blast, another Moono!").image self.moonoDead = False self.timer-= 1 helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 17: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Did you pickup that powerup gem?").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 18: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Gems change how you attack.").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 19: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "These effects don't last long...").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 20: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "...but they do stack!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 21: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "So pick up as many as you can!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 22: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "It is important to make use of gems").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 23: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "They can really help you out!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 24: self.defaultSpawnRate = 2.5 * FRAMES_PER_SECOND self.massAttack = True self.timer = 0 self.currentStep +=1 if self.currentStep == 25: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "They're attacking en masse!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 26: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Try moving slowly towards them.").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 27: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "You can better control your shots.").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 28: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "This can really increase your chances!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,3 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 4 * FRAMES_PER_SECOND and self.currentStep == 29: self.spawnBoss() self.bossFight = True tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Oh no! Its a boss!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 30: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Kill the moonos that spawn.").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer >= 3 * FRAMES_PER_SECOND and self.currentStep == 31: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Some of them will drop a nova.").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer == 3 * FRAMES_PER_SECOND and self.currentStep == 32: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Use the nova when the boss is near").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timer == 3 * FRAMES_PER_SECOND and self.currentStep == 33: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Only novas can hurt bosses!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) self.timer = 0 self.currentStep +=1 if self.timeAfterBoss == 1 * FRAMES_PER_SECOND: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Congratulations!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) if self.timeAfterBoss == 3 * FRAMES_PER_SECOND: tempImage = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Looks like you're ready for a real challenge!").image helpBubble = infoBubble.infoBubble(tempImage, self.player,2 * FRAMES_PER_SECOND) helpBubble.setOffSet(vector.vector2d(0.0,-100.0)) self.textGroup.add(helpBubble) if (self.moonoDead or self.massAttack): self.timer += 1 if self.timeAfterBoss == 5 * FRAMES_PER_SECOND: utility.fadeMusic() return True