Added readme.md

Added keybind F9 for window mode
Player gets damage if he gets hit by enemy projectile
This commit is contained in:
Christian
2024-08-18 14:54:56 +02:00
parent e87c7fed02
commit 31384e03df
5 changed files with 26 additions and 13 deletions

View File

@@ -64,7 +64,13 @@ class Player(GameObject):
if(event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE):
#Fiiirrreee in the hole
#print("Feuer!")
self.fire(self.screen)
self.fire(self.screen)
def get_health(self):
return self._health
def get_damage(self, damage:int):
self._health -= damage
def move(self, x=0, y=0):
if x != 0:
@@ -80,7 +86,9 @@ class Player(GameObject):
self.pos_x += self._speed
def fire(self, screen):
shot = Projectile(self.name, self.pos_x+(self.width/2),self.pos_y-self.height,5,10, screen)
projectile_width = 6
projectile_height = 10
shot = Projectile(self.name, self.pos_x+(self.width/2)-(projectile_width/2), self.pos_y-projectile_height, projectile_width, projectile_height, screen, 10)
def firecontrol(self, screen):
if(len(Projectile.shots) > 0):
@@ -91,7 +99,6 @@ class Player(GameObject):
if(key == "Player"or key == "Player2"):
object.animate("UP")
#print("Playerschuss!")
if(key == "Enemy"):
#print(object.pos_x, " ", object.pos_y)
pass