def load(self): self.display_image = pygame.image.load(self.image).convert_alpha( ) # Loading the image assuming it would be a png file self.display_image = pygame.transform.scale( self.display_image, (self.width, self.height)) # Transforming image to correct width and height def render(self): self.load() # Call the function above gameDisplay.blit(self.display_image, (self.x, self.y)) # Displaying image on the screen try: server = Scores.Scores() # Creating a Server Instance global_high_score = server.get_num_score( ) # Getting Global High Score From Server except: print("cannot connect to server") # If No Internet Connection global_high_score = "Cannot Connect" # Health Management class Health: def __init__(self, x, y, width, height): self.x = x # x-axis of health image self.y = y self.width = width self.height = height
coins_r = coins_r[1].split("'") coins_r = coins_r[0] return coins_r def update_coins(username, coins): url = "http://dodgethat.co.uk/coins.php?username="******"&coins=" + str(coins) + "&password=sameer123" urllib.request.urlopen(url) #User coin functionality ends here #Server connection starts here try: server = Scores.Scores() global_high_score = server.get_num_score() except: print("Cannot connect to server at this moment") global_high_score = "Connection failed" #Heath Management Starts Here class Health: def __init__(self, x, y, width, height): self.x = x # x-axis of health image self.y = y self.width = width self.height = height self.image = "images/health.png"