-
Notifications
You must be signed in to change notification settings - Fork 0
/
cactus.py
29 lines (15 loc) · 840 Bytes
/
cactus.py
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
from pygame import Vector2,draw
from movingObject import MovingObject
from random import randint
class Cactus(MovingObject):
smallCactusStart = (446,2)
smallCactusMargin = (34,70)
def __init__(self,progress,size,y):
super().__init__(progress)
if size == "small":
self.smallCactusSpriteNum = randint(0,5)
self.pos[1] = y-self.smallCactusMargin[1]
def Draw(self,screen,spriteSheet,animationProgress):
screen.blit(spriteSheet,(self.pos[0],self.pos[1]),(self.smallCactusStart[0]+(self.smallCactusMargin[0]*int(self.smallCactusSpriteNum)),self.smallCactusStart[1],self.smallCactusMargin[0],self.smallCactusMargin[1]))
self.hitbox = (self.pos[0],self.pos[1],self.smallCactusMargin[0],self.smallCactusMargin[1])
draw.rect(screen,0x0000ff,self.hitbox,1)