I have the following python / pygame code:
import pygame
import time
pygame.init()
WIDTH = 800
HEIGHT = 600
from pygame.sprite import Actor
alien = Actor('alien')
def draw():
alien.draw()
pygame.quit()
When I run it I get the error:
ImportError: cannot import name 'Actor' from 'pygame.sprite' (/Library/Python/3.9/lib/python/site-packages/pygame/sprite.py)
Do I need my own image? I also have an images/alien.png on the same folder as the code.
How to solve this?
As @Rabbid76 said,
Actoris fromPygame ZeronotPygame. The equivalent code forPygamewould look like this:Please forgive me sending the whole program, that contains more than just how to use pygame Sprites - I don't know your experience level, what you are familiar with and with not.