forked from ismailhasannnnnn/PyMario
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoomba.py
More file actions
27 lines (19 loc) · 833 Bytes
/
goomba.py
File metadata and controls
27 lines (19 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pygame as pg
from vector import Vector
from coords import Coords
from enemy import Enemy
class Goomba(Enemy):
goomba1_rect = Coords.coords["GOOMBA_1"]
goomba2_rect = Coords.coords["GOOMBA_2"]
def __init__(self, game, ul):
goomba_images = [pg.transform.rotozoom(game.spritesheet.image_at(Goomba.goomba1_rect), 0, 2.5),
pg.transform.rotozoom(game.spritesheet.image_at(Goomba.goomba2_rect), 0, 2.5)]
super().__init__(game, ul, image_list=goomba_images, delay=500, isLoop=True)
self.v = Vector(-4, 0)
def collision_check(self):
collision_tolerance = 10
if self.rect.colliderect(self.mario.rect):
if abs(self.mario.rect.bottom - self.rect.top) < 10:
self.kill()
else:
self.mario.kill()