-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbumper.py
More file actions
18 lines (13 loc) · 791 Bytes
/
bumper.py
File metadata and controls
18 lines (13 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import pygame
from pygame.sprite import AbstractGroup
class Bumper(pygame.sprite.Sprite):
def __init__(self, *groups: AbstractGroup, x, y) -> None:
super().__init__(*groups)
self.image = pygame.image.load("./assets/bumper_spr.png").convert_alpha()
self.allImages = [self.image.subsurface((0, 0, 64, 128)), self.image.subsurface((64, 0, 64, 128)), self.image.subsurface((128, 0, 64, 128)), self.image.subsurface((192, 0, 64, 128)), self.image.subsurface((256, 0, 64, 128)), self.image.subsurface((320, 0, 64, 128))]
self.collision = pygame.rect.Rect(x, y, 64, 128)
self.collision.x = x
self.collision.y = y
self.collidedWithBumper = False
def getCordinates(self):
return (self.collision.x, self.collision.y)