-
Notifications
You must be signed in to change notification settings - Fork 0
/
Power_Ups.py
34 lines (29 loc) · 1.33 KB
/
Power_Ups.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
27
28
29
30
31
32
33
34
import pygame, pymunk
from pygame.locals import*
class Power_Up(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
class High_Jump(Power_Up):
def __init__(self, block, sprite_list):
self.sprite_list = sprite_list
self.sprite_iterator = 0
self.body = pymunk.Body(500, pymunk.inf)
self.rect = self.sprite_list[0].get_rect()
self.rect.left = block.rect.left
self.rect.top = block.rect.top - self.sprite_list[0].get_height()
self.body.position = self.rect.center
self.shape = pymunk.Poly.create_box(self.body, (self.sprite_list[0].get_width(), self.sprite_list[0].get_height()))
self.shape.collision_type = 5
self.shape.group = 2
class DashPW(Power_Up):
def __init__(self, block, sprite_list):
self.sprite_list = sprite_list
self.sprite_iterator = 0
self.body = pymunk.Body(500, pymunk.inf)
self.rect = self.sprite_list[0].get_rect()
self.rect.left = block.rect.left
self.rect.top = block.rect.top - self.sprite_list[0].get_height() -30
self.body.position = self.rect.center
self.shape = pymunk.Poly.create_box(self.body, (self.sprite_list[0].get_width(), self.sprite_list[0].get_height()))
self.shape.collision_type = 15
self.shape.group = 2