def registerUserForLadder(): handle = request.args.get('handleLadder', '') obj = ladder.Ladder() vis = obj.signupUserForLadder(handle) print vis if (vis == 1): return jsonify(success='True', msg='User Registered') else: return jsonify(success='False', msg='User already Registered!')
def updateUserLadder(handle): obj = ladder.Ladder() obj.updateProblemCount(handle) vis = obj.showAllProblems(handle) return render_template('listLadderProblems.html', handle=handle, vis=vis, A=obj.A, B=obj.B, N=obj.N, probName=obj.problemNames)
def openLadder(): handle = request.args.get('handle', '') obj = ladder.Ladder() vis = obj.showAllProblems(handle) return render_template('listLadderProblems.html', handle=handle, vis=vis, A=obj.A, B=obj.B, N=obj.N, probName=obj.problemNames)
def __init__(self, player): Level.__init__(self, player) level2 = [[40, 80, 300, 120], [40, 80, 700, 220], [40, 80, 400, 320], [40, 80, 500, 420], [40, 80, 200, 520], [40, 50, 800, 620], [40, 70, 200, 40], [40, 50, 650, 40], [40, 50, 650, 140], [40, 50, 100, 320], [40, 50, 100, 450]] level = [[1000, 1, 0, 0], [900, 1, 100, 699], [99, 30, 100, 40], [39, 30, 241, 40], [20, 39, 79, 0], [20, 39, 281, 0], [180, 30, 600, 40], [299, 30, 0, 120], [200, 30, 341, 120], [299, 30, 400, 220], [259, 30, 741, 220], [399, 30, 0, 320], [300, 30, 441, 320], [199, 30, 300, 420], [459, 30, 541, 420], [199, 30, 0, 520], [600, 30, 241, 520], [99, 30, 700, 620], [159, 30, 841, 620]] for plat in level: block = platform.Platform(plat[0], plat[1]) block.rect.x = plat[2] block.rect.y = plat[3] block.player = self.player self.platform_list.add(block) for lad in level2: block = ladder.Ladder(lad[0], lad[1]) block.rect.x = lad[2] block.rect.y = lad[3] self.ladder_list.add(block) for i in range(50): coin = coins.Coins(20, 20) coin.rect.x = random.randrange(1000) coin.rect.y = random.randrange(700) self.coins_list.add(coin) for j in self.platform_list: plat_coin_hit_list = pygame.sprite.spritecollide( j, self.coins_list, True) q = queen.Queen(30, 30) q.rect.x = random.randrange(100, 280) q.rect.y = 9 self.queen_list.add(q)
def __init__(self, screen): """ Constructor for Board class """ # Sprite group which contains player,donkey and priness self.active_sprite_list = pygame.sprite.Group() # Initializes all the platforms for the game self.screen = screen self.platform_zero = landforms.ZeroPlatform() self.platform_one = landforms.FirstPlatform() self.platform_two = landforms.SecondPlatform() self.platform_three = landforms.ThirdPlatform() self.platform_four = landforms.FourthPlatform() # Initializes all the ladders for the game self.broken_ladder_one = ladder.BrokenLadder(200, constants.SCREEN_HEIGHT) self.ladder_two = ladder.Ladder(400, constants.SCREEN_HEIGHT) self.ladder_three = ladder.Ladder(300, constants.ONE_Y) self.ladder_four = ladder.Ladder(550, constants.TWO_Y) self.ladder_five = ladder.Ladder(450, constants.THREE_Y) # Initializes the cage surrounding the princess self.cage_one = cage.CageOne() # Initializes the player and princess for the game self.knight = player.Player() self.lady = princess.Princess(constants.SCREEN_HEIGHT - 100, constants.FOUR_Y) self.knight.set_princess(self.lady) # Add the player and princess the active sprite list self.active_sprite_list.add(self.knight) self.active_sprite_list.add(self.lady) # Set the score board for the game self.score_board = scoreboard.ScoreBoard(self.knight)
def initladders(self, screen): # Initialize all ladders self.ladders = [ ladder.Ladder("Images/ladder.png", "Images/ladder.png", (800, 419), self.LADDER_WIDTH, self.FULL_LADDER_HEIGHT), ladder.Ladder("Images/ladder.png", "Images/ladder.png", (300, 339), self.LADDER_WIDTH, self.FULL_LADDER_HEIGHT), ladder.Ladder("Images/ladder.png", "Images/ladder.png", (500, 259), self.LADDER_WIDTH, self.FULL_LADDER_HEIGHT), ladder.Ladder("Images/ladder.png", "Images/ladder.png", (900, 179), self.LADDER_WIDTH, self.FULL_LADDER_HEIGHT), ladder.Ladder("Images/ladder.png", "Images/ladder.png", (600, 99), self.LADDER_WIDTH, self.FULL_LADDER_HEIGHT), ladder.Ladder("Images/ladder_broken.png", "Images/ladder_broken.png", (650, 335), self.LADDER_WIDTH, self.HALF_LADDER_HEIGHT), ladder.Ladder("Images/ladder_broken_down.png", "Images/ladder_broken_down.png", (650, 400), self.LADDER_WIDTH, self.HALF_LADDER_HEIGHT), ladder.Ladder("Images/ladder_broken.png", "Images/ladder_broken.png", (850, 255), self.LADDER_WIDTH, self.HALF_LADDER_HEIGHT), ladder.Ladder("Images/ladder_broken_down.png", "Images/ladder_broken_down.png", (850, 320), self.LADDER_WIDTH, self.HALF_LADDER_HEIGHT), ladder.Ladder("Images/ladder_broken.png", "Images/ladder_broken.png", (300, 95), self.LADDER_WIDTH, self.HALF_LADDER_HEIGHT), ladder.Ladder("Images/ladder_broken_down.png", "Images/ladder_broken_down.png", (300, 160), self.LADDER_WIDTH, self.HALF_LADDER_HEIGHT), ladder.Ladder("Images/castleladder.png", "Images/castleladder.png", (220, 45), self.LADDER_WIDTH, ((self.FULL_LADDER_HEIGHT - 5) * 2) / 3) ] for l in self.ladders: x, y = l.getPosition() w, h = l.getSize() if h == self.FULL_LADDER_HEIGHT: self.ladderlimits[l.getPosition()] = y + 1 + 60 else: if h == ((self.FULL_LADDER_HEIGHT - 5) * 2) / 3: self.ladderlimits[l.getPosition()] = y + 5 + 30 elif y % 10 == 0: self.ladderlimits[l.getPosition()] = y else: self.ladderlimits[l.getPosition()] = y + 5 + 60 self.ladder_group = pygame.sprite.RenderPlain(*self.ladders) if (self.MODE == 1): self.ladder_group.draw(screen)