Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple game help
#1
I'm trying to make a simple game in python.
import pygame
from pygame.locals import *

pygame.init()
width, height = 640, 480
screen=pygame.display.set_mode ((width, height))

player = pygame.image.load("/home/pi/Downloads/resources/images/dude.png")
grass = pygame.image.load("/home/pi/Downloads/resources/images/grass.png")
castle = pygame.image.load("/home/pi/Downloads/resources/images/castle.png")

while 1:
    screen.fill(0)
    
    screen.blit(player, (100,100))
    pygame.display.flip()

    for events in pygame.even.get():
        if events.type==pygame.QUIT:
            pygame.quit()
            exit(0)
I keep getting "AttributeError: module 'pygame' has no attribute 'even'

Would love some help, as I am very new to coding and new to python. Thanks!

just realized i mispelled event as even, so hopefully no one else runs into this problem. Smile
Reply
#2
I suspect you are trying to call pygame.event.get() and have misspelled "event".
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to make a simple pong game. kevindadmun 1 3,872 Aug-05-2019, 06:39 AM
Last Post: kevindadmun
  Simple Game - Choice Based theor 3 2,880 May-10-2019, 08:41 AM
Last Post: beLIEve
  simple pygame game kinglarry0327 0 7,851 Jan-06-2019, 06:18 PM
Last Post: kinglarry0327
  Simple Digimon Game - Suggestions Welcome prog92 2 4,320 Jun-01-2017, 09:53 PM
Last Post: prog92

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020