Я создаю платформенную игру и пытаюсь сократить свой код, создав класс для платформ.Тем не менее, мой код не запускается, и я не уверен, что ошибка отображается.
Мой код:
import pygame,sys,time,random
pygame.init()
#COLOUR
light_red=(255,99,71)
res_x,res_y=800,600
display = pygame.display.set_mode((res_x,res_y))
display.fill(black)
pygame.display.update()
clock=pygame.time.Clock()
fps=60
class Rect:
def __int__(self,color,x,y,l,h,th):
self.color=color
self.x=x
self.y=y
self.l=l
self.h=h
self.th=th
rect1=pygame.draw.rect(display,Rect('light_red','random.randrange(0,150)','150','300','50','5'))
pygame.display.update()
Показана ошибка:
rect1=pygame.draw.rect(display,Rect('light_red','random.randrange(0,150)','150','300','50','5'))
TypeError: Rect() takes no arguments