def __init__(self, screen, x, y): self.screen = screen self.x_logo = x self.y_logo = y self.x_btn = x-30 self.y_btn = y+70 self.font = constants.load_font("LithosPro", 20) self.y_t = self.y_btn+10 d = shelve.open('info') try : self.user, self.token = d['user'] except: self.user, self.token = ('','') d.close() self.api = gjapi.GameJoltTrophy(self.user, self.token, constants.GAME_ID, constants.PRIVATE_KEY) #if self.api.authenticateUser(): #self.logged = True #self.api.openSession() #self.btn = Gj.btnh #self.text = self.font.render(self.user, 1, constants.BLACK) #pygame.time.set_timer(27, 35000) #else: self.logged = False self.btn = Gj.btn self.text = self.font.render("Offline", 1, constants.BLACK) _thread.start_new_thread(self.login, (self.user, self.token)) self.opened = False options = {'x':150, 'y':200, 'font':self.font, 'color':constants.DLIGHT_BLUE, 'maxlength':25, 'prompt1':"Username: "******"Token: "} self.txtbx = eztext.Input(**options) self.tip1 = self.font.render("- Tab to switch between text boxes", 1, constants.OFF_WHITE) self.tip2 = self.font.render("- Enter to login", 1, constants.OFF_WHITE) self.tip3 = self.font.render("- Esc to go back", 1, constants.OFF_WHITE)
def draw(self): screen.blit(self.bg, [0, 0]) self.menu.draw() screen.blit(self.score_block_img, (175, 95)) font = constants.load_font("LithosPro", 32) for i in range(5): n = font.render(str(i + 1) + " - ", 1, constants.LIGHT_BLUE) label = font.render(str(self.score[i]), 1, constants.LIGHT_BLUE) s = label.get_rect().size screen.blit(n, (200, 150 + (50 * i) - s[1] / 2)) screen.blit(label, (400 - s[0] / 2, 150 + (50 * i) - s[1] / 2)) screen.blit(self.cursor, (self.mouse_pos[0], self.mouse_pos[1]))
def draw(self): screen.blit(self.bg, [0,0]) self.menu.draw() screen.blit(self.score_block_img, (175, 95)) font = constants.load_font("LithosPro", 32) for i in range(5): n = font.render(str(i+1)+" - ", 1, constants.LIGHT_BLUE) label = font.render(str(self.score[i]), 1, constants.LIGHT_BLUE) s = label.get_rect().size screen.blit(n, (200, 150 + (50*i) - s[1]/2)) screen.blit(label, ( 400 - s[0]/2, 150 + (50*i) - s[1]/2)) screen.blit(self.cursor, (self.mouse_pos[0], self.mouse_pos[1]))
def draw(self,screen): self.moving_object.draw_next(screen) # List of stopped blocks, and any moving block in the game area # ** Moving blocks are spawned above the game area, if they haven't # ** entered yet, they are not drawn for b in self.stop_list: b.draw(screen) mlist = [] if not self.lost : mlist = [ x for x in self.moving_object.get_list() if x.drawable()] for b in mlist: b.draw(screen) font = constants.load_font("LithosPro", 27) label = font.render(str(self.score), 1, constants.LIGHT_BLUE) s = label.get_rect().size screen.blit(label, (651 - s[0]/2, 446 - s[1]/2)) # Animation bitch if self.animate > 0: font = constants.load_font("LithosPro", 17) label = font.render("+"+str(self.add_score), 1, constants.LIGHT_BLUE) screen.blit(label, (651 + s[0]/2 + 3, 446 - s[1]/2 + 3)) for b in self.to_remove_list: b.explode(screen, self.animate//2) self.animate -= 1