Updated enemy class
This commit is contained in:
3
Enemy.py
3
Enemy.py
@@ -9,7 +9,7 @@ class Enemy(GameObject.GameObject):
|
|||||||
|
|
||||||
def fire(self, screen):
|
def fire(self, screen):
|
||||||
print("Schieße!!!!")
|
print("Schieße!!!!")
|
||||||
shot = Projectile(" ", self.pos_x+(self.width/2),self.pos_y+self.height,10,5, screen)
|
shot = Projectile(" ", self.pos_x+(self.width/2),self.pos_y+self.height,5,10, screen)
|
||||||
self.shots_fired.append(shot)
|
self.shots_fired.append(shot)
|
||||||
|
|
||||||
def shoot(self):
|
def shoot(self):
|
||||||
@@ -37,3 +37,4 @@ class Projectile(GameObject.GameObject):
|
|||||||
def animate(self):
|
def animate(self):
|
||||||
self.rect = pygame.draw.rect(self.screen, (0,0,0), (self.pos_x, self.pos_y, self.width, self.height))
|
self.rect = pygame.draw.rect(self.screen, (0,0,0), (self.pos_x, self.pos_y, self.width, self.height))
|
||||||
self.pos_y += self.speed
|
self.pos_y += self.speed
|
||||||
|
|
||||||
|
|||||||
@@ -62,4 +62,3 @@ class Player(GameObject):
|
|||||||
self.pos_x += x
|
self.pos_x += x
|
||||||
if y != 0:
|
if y != 0:
|
||||||
self.pos_y += y
|
self.pos_y += y
|
||||||
|
|
||||||
5
test.py
5
test.py
@@ -55,8 +55,7 @@ while(gamestate):
|
|||||||
pos_y = mouse_pos[1]
|
pos_y = mouse_pos[1]
|
||||||
|
|
||||||
#Rendere alle Objecte in objects Liste
|
#Rendere alle Objecte in objects Liste
|
||||||
player.render(screen)
|
|
||||||
enemy.render(screen)
|
|
||||||
|
|
||||||
rand = random.randint(0, 100)
|
rand = random.randint(0, 100)
|
||||||
|
|
||||||
@@ -70,6 +69,8 @@ while(gamestate):
|
|||||||
|
|
||||||
enemy.shoot()
|
enemy.shoot()
|
||||||
|
|
||||||
|
player.render(screen)
|
||||||
|
enemy.render(screen)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user