2022-04-23 19:14:23 +02:00
|
|
|
import pygame as pg
|
2022-03-24 17:30:28 +01:00
|
|
|
|
2022-04-23 19:14:23 +02:00
|
|
|
class trashbin(pg.sprite.Sprite):
|
2022-03-24 17:30:28 +01:00
|
|
|
|
2022-03-24 17:33:54 +01:00
|
|
|
def __init__(self,x,y,img, type):
|
2022-03-24 17:30:28 +01:00
|
|
|
super().__init__()
|
|
|
|
|
2022-03-24 17:33:54 +01:00
|
|
|
# trashbin type
|
|
|
|
self.type = type
|
|
|
|
|
2022-03-24 17:59:30 +01:00
|
|
|
# dimensions
|
|
|
|
if type == "small":
|
|
|
|
self.width = 4
|
|
|
|
self.height = 4
|
|
|
|
elif type == "medium":
|
|
|
|
self.width = 8
|
|
|
|
self.height = 8
|
|
|
|
elif type == "large":
|
|
|
|
self.width = 16
|
|
|
|
self.height = 16
|
|
|
|
|
2022-03-24 17:30:28 +01:00
|
|
|
# spawn coords
|
2022-03-24 17:31:12 +01:00
|
|
|
self.x = x
|
|
|
|
self.y = y
|
2022-03-24 17:30:28 +01:00
|
|
|
|
|
|
|
# load trashbin image
|
2022-04-23 19:14:23 +02:00
|
|
|
self.image = pg.image.load(img)
|
|
|
|
self.image = pg.transform.scale(self.image, (self.x,self.y))
|
|
|
|
self.rect = self.image.get_rect()
|