Skip to content
← Back to Community
How do I add a Circle that moves in this?
Profile icon
ZeeMan

I'm a beginner at graphics and could someone help me add a circle above the purple half that moves with keys a and d?

Answered by mwilki7 [earned 5 cycles]
View Answer
Voters
Profile icon
MichaelJones29
Profile icon
dillonjoshua68
Profile icon
ZeeMan
Comments
hotnewtop
Profile icon
mwilki7

you have to change the coordinates of the circle each time the loop passes

for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: # do stuff with left key if event.key == pygame.K_RIGHT: # do stuff with right key
Profile icon
ZeeMan

@mwilki7 Thank you!

Profile icon
[deleted]

should be something like pygame.draw.circle(color, color,color),(x,y)
and to make it move you need up update the location of its x cordinate when the key is pressed

Profile icon
ZeeMan

Ha ha it works but funnily