-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
467 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,66 @@ | ||
import pygame | ||
from characters import Character | ||
from textures import img | ||
from enums import Direction | ||
from weapons import Pistol, Tompson, Mp40 | ||
|
||
|
||
class Enemy1(Character): | ||
class Enemy(Character): | ||
def __init__(self, x, y): | ||
super().__init__() | ||
self.image = self.org_image = img.enemy1 | ||
self.rect.x = x | ||
self.rect.y = y | ||
self.hp = 100 | ||
self.selectedgun = None | ||
self.last_attack = 0 | ||
self.period = 0 | ||
self.enemy = True | ||
self.pointsdamage = 0 | ||
self.points = 0 | ||
|
||
def damage(self, n): | ||
super().damage(n) | ||
if self.hp <= 0: | ||
self.kill() | ||
return True | ||
return False | ||
|
||
def attack(self, blasts): | ||
if pygame.time.get_ticks() - self.last_attack < self.period: | ||
return | ||
blasts.add(self.selectedgun.blast(self, self.direction)) | ||
self.last_attack = pygame.time.get_ticks() | ||
|
||
def draw(self, screen): | ||
self.selectedgun.drawmini(self, screen) | ||
|
||
|
||
class Enemy1(Enemy): | ||
def __init__(self, x, y): | ||
super().__init__(x, y) | ||
self.image = self.org_image = img.enemy1 | ||
self.hp = 500 | ||
self.selectedgun = Pistol(0, 0) | ||
self.period = 2000 | ||
self.pointsdamage = 5 | ||
self.points = 10 | ||
|
||
|
||
class Enemy2(Enemy): | ||
def __init__(self, x, y): | ||
super().__init__(x, y) | ||
self.image = self.org_image = img.enemy2 | ||
self.hp = 1000 | ||
self.selectedgun = Tompson(0, 0) | ||
self.period = 500 | ||
self.pointsdamage = 7 | ||
self.points = 20 | ||
|
||
|
||
class Enemy3(Enemy): | ||
def __init__(self, x, y): | ||
super().__init__(x, y) | ||
self.image = self.org_image = img.enemy3 | ||
self.hp = 1500 | ||
self.selectedgun = Mp40(0, 0) | ||
self.selectedgun.blast.speed = 12 | ||
self.period = 500 | ||
self.pointsdamage = 9 | ||
self.points = 35 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.