mirror of
https://github.com/BreizhHardware/project_sanic.git
synced 2026-03-18 21:50:33 +01:00
Feat[projectiles], add assets for the projectile of the player
This commit is contained in:
BIN
assets/player/Boule de feu.png
Normal file
BIN
assets/player/Boule de feu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -502,6 +502,7 @@ class Player(Entity):
|
||||
damage=1,
|
||||
color=(165, 42, 42),
|
||||
enemy_proj=False,
|
||||
texturePath="assets/player/Boule de feu.png",
|
||||
)
|
||||
# Add projectile to the sprite group (to be placed in main.py)
|
||||
pygame.event.post(
|
||||
@@ -525,6 +526,7 @@ class Player(Entity):
|
||||
damage=1,
|
||||
color=(165, 42, 42),
|
||||
enemy_proj=False,
|
||||
texturePath="assets/player/Boule de feu.png",
|
||||
)
|
||||
# Add projectile to the sprite group (to be placed in main.py)
|
||||
pygame.event.post(
|
||||
|
||||
@@ -5,10 +5,17 @@ from pygame.math import Vector2 as vec
|
||||
|
||||
class Projectile(Entity):
|
||||
def __init__(
|
||||
self, pos, direction, speed, damage, color=(0, 0, 255), enemy_proj=False
|
||||
self,
|
||||
pos,
|
||||
direction,
|
||||
speed,
|
||||
damage,
|
||||
color=(0, 0, 255),
|
||||
enemy_proj=False,
|
||||
texturePath="",
|
||||
):
|
||||
# Appel du constructeur parent avec les paramètres appropriés
|
||||
super().__init__(pos=pos, size=(10, 10), color=color)
|
||||
super().__init__(pos=pos, size=(50, 50), color=color, texturePath=texturePath)
|
||||
|
||||
# Attributs spécifiques aux projectiles
|
||||
self.direction = direction.normalize() if direction.length() > 0 else vec(1, 0)
|
||||
|
||||
@@ -245,6 +245,7 @@ def handler():
|
||||
P1.move()
|
||||
P1.update()
|
||||
P1.attack()
|
||||
projectiles.update(WIDTH, HEIGHT, P1, camera)
|
||||
|
||||
# Update camera to follow player
|
||||
camera.update(P1)
|
||||
|
||||
Reference in New Issue
Block a user