def levelGen(): rotPlatforms.append( Element.Entity((640, 1350), 'Mid B Lg.png', (0, -500), rotDir, (776, 1005))) #rotPlatforms.append(Element.Entity((640,1450), 'Top Lg.png', (0, -660), rotDir, (1024,1327))) rotPlatforms[0].initialRot(0) linPlatforms.append(Element.linearEntity(0, 1, 1)) ramps.append(Element.linearRamp(linPlatforms[0], 1)) #TODO: Implement platforms of different height, using random to select which type to add rotPlatforms.append( Element.Entity((640, 1350), 'Mid B Lg.png', (0, -500), rotDir, (776, 1005))) #Change this to increase or decrease rotation variance rotPlatforms[1].initialRot(45 + random.randint(1, 60)) linPlatforms.append(Element.linearEntity(rotPlatforms[1].angle, 1, 1)) ramps.append(Element.linearRamp(linPlatforms[1], 1)) rotPlatforms.append( Element.Entity((640, 1350), 'Mid B Sm.png', (0, -500), rotDir, (350, 1006))) #rotPlatforms.append(Element.Entity((640,1350), 'Mid B Lg.png', (0, -500), rotDir, (776,1005))) #Rotation variance rotPlatforms[2].initialRot(rotPlatforms[1].angle + random.randint(46, 90)) linPlatforms.append(Element.linearEntity(rotPlatforms[2].angle, 1, 2)) ramps.append(Element.linearRamp(linPlatforms[2], 2)) rotPlatforms[0].add(allSprites) rotPlatforms[1].add(allSprites) rotPlatforms[2].add(allSprites)
def levelUpdate(): allSprites.remove(rotPlatforms[0]) rotPlatforms.pop(0) linPlatforms.pop(0) ramps.pop(0) pWidth = random.randint(1, 2) pHeight = random.randint(1, 2) if (pWidth == 1): if (pHeight == 1): rotPlatforms.append( Element.Entity((640, 1350), 'Mid B Lg.png', (0, -500), rotDir, (776, 1005))) else: rotPlatforms.append( Element.Entity((640, 1450), 'Top Lg.png', (0, -660), rotDir, (1024, 1327))) else: if (pHeight == 1): rotPlatforms.append( Element.Entity((640, 1350), 'Mid B Sm.png', (0, -500), rotDir, (350, 1006))) else: rotPlatforms.append( Element.Entity((640, 1450), 'Top Sm.png', (0, -660), rotDir, (463, 1327))) #Change this random number to increase or decrease rotation variance randomAngle = random.randint(60, 90) rotPlatforms[2].initialRot(rotPlatforms[1].angle + randomAngle) linPlatforms.append( Element.linearEntity(rotPlatforms[2].angle, pHeight, pWidth)) ramps.append(Element.linearRamp(linPlatforms[2], pWidth)) rotPlatforms[2].add(allSprites)
g = 98 getTicksLastFrame = 0 jump = False unlockJumping = False deltaT = 0.0 curPlatform = 0 speed = 0 rotDir = -1 #speed and rotation of the platforms temp = 0 i = 0 ringBasePos = 0 jumpVel = 0 score = 0 # Used to store the score of the player isPressed = False distTravelled = 0 background = Element.Entity((640, 360), 'space.png', (0, 0), -1, (1280, 720)) startButton = pygame.image.load(os.getcwd() + "\\images\\Highlight.png") rectButton = startButton.get_rect() rectButton.x = 780 rectButton.y = 460 tStart = pygame.image.load(os.getcwd() + "\\images\\Main menu.png") tStart = pygame.transform.scale(tStart, (1280, 720)) rectStart = tStart.get_rect() tArrow = pygame.image.load(os.getcwd() + "\\images\\Arrow Up.png") tArrow = pygame.transform.scale(tArrow, (100, 100)) rectArrow = tArrow.get_rect() tControl = pygame.image.load(os.getcwd() + "\\images\\Controls.png")