-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpickups.py
More file actions
51 lines (39 loc) · 1.38 KB
/
pickups.py
File metadata and controls
51 lines (39 loc) · 1.38 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import pygame.image
import player
import sprite
class Coin(sprite.AnimatedSprite):
def __init__(self, pos):
super().__init__(
pos,
image_path='game_core/sprites/animated_sprites/coin/idle/coin1.png',
anim_path='game_core/sprites/animated_sprites/coin',
anim_states={'idle': []},
anim_speed=0.1
)
class HpMushroom(sprite.Sprite):
def __init__(self, pos):
super().__init__(
pos=pos,
image_path='game_core/sprites/castle/hp_mushroom.png'
)
class StaminaMushroom(sprite.Sprite):
def __init__(self, pos):
super().__init__(
pos=pos,
image_path='game_core/sprites/castle/stamina_mushroom.png'
)
class AntiGravityPotion(sprite.Sprite):
def __init__(self, pos, player_obj: player.Player):
super().__init__(
pos,
image_path='game_core/sprites/castle/antigravity_potion.png'
)
self.player = player_obj
self.duration = 150
def apply_effect(self):
self.player.player_gravity = -1
self.player.jump_speed = -3
self.player.image = pygame.transform.flip(self.player.image, flip_y=True, flip_x=False)
def stop_effect(self):
self.player.player_gravity = self.player.CONST_PLAYER_GRAVITY
self.player.jump_speed = self.player.CONST_JUMP_SPEED