Note that there are some explanatory texts on larger screens.

plurals
  1. POPygame draw not drawing what it should
    primarykey
    data
    text
    <p>Ok, so I am using pygame.draw to make a stick figure in the class called Entity:</p> <pre><code>class Entity: #Used with default arguments blited on a 600 by 600 pixel screen def __init__(self, pos=[300, 300]): self.pos = pos self.legR = [10, 25] self.legL = [-10, -25] self.armR = [0, 0] self.armL = [0, 0] self.body = [30, 5] self.head = [0, 0, 5] self.size = [60, 110] self.color = [0, 0, 0] self.image = pygame.surface.Surface(self.size) self.image.fill([255, 255, 255]) def render(self, screen, frame): self.image = pygame.surface.Surface(self.size) self.image.fill([255, 255, 255]) pygame.draw.line(self.image, self.color, [self.size[0]/2, self.size[1]/2], [self.size[0]/2+self.legR[0], self.size[0]/2+self.legR[1]], 5) pygame.draw.line(self.image, self.color, [self.size[0]/2, self.size[1]/2], [self.size[0]/2+self.legL[0], self.size[0]/2+self.legL[1]], 5) pygame.draw.line(self.image, self.color, [self.size[0]/2, self.size[1]/2], [self.size[0]/2+self.body[0], self.size[0]/2+self.body[1]], self.body[1]) pygame.draw.circle(self.image, self.color, [self.size[0]/2+self.body[0]+self.head[0], self.size[1]/2+self.body[1]+self.head[1]], self.head[2]) #pygame.draw.line(self.image, self.color, [self.size/2 screen.blit(self.image, self.pos) </code></pre> <p>So I run this and it gives me this weird messed up image with a bunch of lines in random directions. It seams to me I do not really understand the function well. Could I please have a example of a render able stick figure with configurable joints? If not, could someone please at least tell me my fatal error? Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload