0

import pygame

class popUpWindow:

 #Initialization of Window
 def __init__(self,capNa,width,height):
      self.screen = pygame.init()
      self.capNa = capNa
      self.width = width
      self.height = height
      self.screen = pygame.display.set_mode((self.width,self.height))
      pygame.display.set_caption(self.capNa)
      #Make Player
      self.px = float
      self.py = float
      self.psrc = 'Images/player.png'
      self.player_load = pygame.image.load(self.psrc)

 def LoadPlayer(self):
      self.screen.blit(self.player_load, (self.px,self.py))
      pygame.display.update()

 def runWindow(self):
      self.__init__(self.capNa,self.width,self.height)
      self.Is_running = True
      self.player_load()
      while self.Is_running:
           for event in pygame.event.get():
                if event.type == pygame.QUIT:
                     pygame.quit()
           pygame.display.update()
           

 def closeWindow(self):
      pygame.quit()

I tried to make the code change the player position but I failed! How can I change the player positions at any time, without returning back to the code.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Ahmed
  • 1
  • 2

0 Answers0