-
Notifications
You must be signed in to change notification settings - Fork 0
/
projectile.py
69 lines (51 loc) · 2.29 KB
/
projectile.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import pygame
import random
class Projectile(pygame.sprite.Sprite):
def __init__(self, player, typen):
super().__init__()
self.player = player
self.typen = typen
self.velocity = 5
self.image = pygame.image.load("images/fourchettL.png")
self.image = pygame.transform.scale(self.image, (58,58))
self.rect=self.image.get_rect()
self.rect.x = player.rect.x
self.rect.y = player.rect.y + 5
if self.typen == "boss":
self.rect.y = player.rect.y + random.randint(0,200)
def suppr(self):
self.player.tt_projectiles1.remove(self)
self.player.tt_projectiles2.remove(self)
def move_d(self):
self.rect.x += self.velocity
self.image = pygame.image.load("images/fourchettR.png")
if self.rect.x > 1022 :
self.suppr()
if self.typen == "player" :
for monster in self.player.game.check_collisionMonstre(self, self.player.game.tt_monsters):
self.suppr()
#infliger des dégats
monster.damage(self.player.attack)
for boss in self.player.game.check_collisionMonstre(self, self.player.game.tt_boss):
self.suppr()
boss.damage(self.player.attack)
if self.typen == "boss" :
for player in self.player.game.check_collisionMonstre(self, self.player.game.tt_players):
self.suppr()
player.damage(self.player.game.boss.attack)
def move_g(self):
self.rect.x -= self.velocity
if self.rect.x < 0 :
self.suppr()
if self.typen == "player" :
for monster in self.player.game.check_collisionMonstre(self, self.player.game.tt_monsters):
self.suppr()
#infliger des dégats
monster.damage(self.player.attack)
for boss in self.player.game.check_collisionMonstre(self, self.player.game.tt_boss):
self.suppr()
boss.damage(self.player.attack)
if self.typen == "boss" :
for player in self.player.game.check_collisionMonstre(self, self.player.game.tt_players):
self.suppr()
player.damage(self.player.game.boss.attack)