python 3.x - pygames / drawing circle that bounces off walls -
python 3.x - pygames / drawing circle that bounces off walls -
b1 = {'rect':pygame.rect(300, 80, 50, 100), 'color':red, 'dir':upright} b2 = {'rect':pygame.rect(200, 200, 20, 20), 'color':green, 'dir':upleft} b3 = {'rect':pygame.rect(100, 150, 60, 60), 'color':blue, 'dir':downleft} b4 = {'rect':pygame.draw.circle((300, 50), 20, 0,), 'color':purple, 'dir':downright} blocks = [b1, b2, b3] # draw block onto surface pygame.draw.rect(windowsurface, b['color'], b['rect']) pygame.draw.circle(windowsurface, b['color'], (300, 50), 20, 0)
brand new pygames (programming in general). 1 of our first assignments, edit simple programme bounces squares off walls. add together circle i'm not able figure out how fit pre-existing dict construction rectangles. i'm getting next error, not seeing:
traceback (most recent phone call last): file "c:\users\ca115\downloads\animation1.py", line 32, in <module> b4 = {'rect':pygame.draw.circle((300, 50), 20, 0,), 'color':purple, 'dir':downright} typeerror: function takes @ to the lowest degree 4 arguments (3 given)
a quick @ pygame's documentation shows providing less parameters expected. in general, that's python telling when said "typeerror: function takes @ to the lowest degree 4 arguments (3 given)".
a little more detail: in line 32, error trace specifies, causes problem dictionary entry 'rect':pygame.draw.circle((300, 50), 20, 0,)
. documentation linked, should able figure out went wrong here.
another hint. since said new programming in general, should note parameters pygame.rect
, pygame.draw.circle
have important difference: rect
takes in primitive python values ("numbers") while circle
needs particular object.
python-3.x pygame
Comments
Post a Comment