In the process of executing this Pygame code, the following error appears on my terminal regardless of the corrections made to the code:
AttributeError: 'naveEspacial' object has no attribute 'dibujar'
How can I correct my code of this error and finally manage to execute the image? But more importantly, how can I prevent this from happening?
Thank you in advance.
import pygame,sys
from pygame.locals import *
# global variables
ancho = 900
alto = 480
class naveEspacial(pygame.sprite.Sprite):
"""Class for the thumb up ."""
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.ImagenNave = pygame.image.load('emojione-png/1f44d.png')
self.rect = self.ImagenNave.get_rect()
self.rect.centerx = ancho/2
self.rect.centery = alto-30
self.listaDisparo= []
self.Vida = True
def disparar(self):
pass
def dibujar(self, superficie):
superficie.blit(self.ImagenNave, self.rect)
def Spaceinvader():
pygame.init()
venta = pygame.display.set_mode((ancho,alto))
pygame.display.set_caption("faceinvader")
ImagenFondo = pygame.image.load("Image/fondo.jpg")
jugador = naveEspacial()
while True:
for evento in pygame.event.get():
if evento.type == QUIT:
pygame.quit()
sys.exit()
venta.blit (ImagenFondo, (0,0))
jugador.dibujar(venta)
pygame.display.update()
Spaceinvader()
UPDATE: