Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hey why doesnt this thing get fixed #33

Open
nazlicodings opened this issue May 12, 2024 · 1 comment
Open

hey why doesnt this thing get fixed #33

nazlicodings opened this issue May 12, 2024 · 1 comment

Comments

@nazlicodings
Copy link

import pygame
pygame.init()
a=500
b=500
screen=pygame.display.set_mode((a,b))
run=True
x=250
y=250
while run:
for event in pygame.event.get():
if event.type==pygame.KEYDOWN:
if event.key==pygame.k_w:
y=y-5
if y<=0:
y=b
if event.key==pygame.k_s:
y=y+5
if y>=b:
y=0
if event.key==pygame.k_a:
x=x-5
if x<=0:
x=a
if event.key==pygame.k_d:
x=x+5
if x>=a:
x=0

screen.fill((0,0,0))
pygame.draw.circle(screen,(255,255,255),(x,y),20,0)
pygame.display.update()
pygame.displaySurfacequit()

and this happens when i run the file
Python 3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.

= RESTART: C:\Users\zagros\Desktop\کد خودم.py
pygame 2.5.2 (SDL 2.28.3, Python 3.12.3)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "C:\Users\zagros\Desktop\کد خودم.py", line 16, in
if event.key==pygame.k_s:
AttributeError: 'pygame.event.Event' object has no attribute 'key'

@richardgrechko
Copy link

offtopic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants