#๐Ÿ”’ Rect not working

11 messages ยท Page 1 of 1 (latest)

atomic vaporBOT
#

@snow rose

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

snow rose
#

import pygame

pygame.init()
WIDTH, HEIGHT = 1000, 600
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Flappy Square")

WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)

class Bird:
def init(self):
self.x = 0
self.y = 0
self.rect = pygame.Rect(self.x, self.y, 40, 40)

bird = Bird()

running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False

screen.fill(BLACK)
pygame.draw.rect(screen, GREEN, bird.rect)

pygame.display.update()

pygame.quit()

safe warren
#

it's because

#

you need

#

__init__

#

not _init_

snow rose
#

oh ok

#

thx

#

bruh

atomic vaporBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.