-
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
1 parent
865ebc0
commit 44a65d4
Showing
11 changed files
with
84 additions
and
16 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
import random | ||
from src.board import * | ||
from src.building import * | ||
from src.input import * | ||
|
||
def main(): | ||
|
||
board = Board() | ||
while(True): | ||
os.system('clear') | ||
board.display() | ||
ip = input_to() | ||
if(ip == 'q'): | ||
os.system('clear') | ||
exit() | ||
else: | ||
print(ip) | ||
print("Invalid Move!") | ||
# pass | ||
|
||
|
||
|
||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
from colorama import Fore, Back, Style, init | ||
|
||
init() | ||
|
||
|
||
|
||
class Building: | ||
def __init__(self, height, length, health): | ||
self.health = health | ||
self.height = height | ||
self.length = length | ||
self.content = [[Fore.GREEN + 'X']*self.length for tile in range(self.height)] | ||
|
||
def attacked(self): | ||
self.health -= 1 | ||
if self.health == 0: | ||
self.destroy() | ||
|
||
def destroy(self): | ||
self.content = [[' ']*self.length for tile in range(self.height)] | ||
|
||
def update_color(self, color): | ||
for row in self.content: | ||
for i in range(len(row)): | ||
row[i] = color + row[i] + Fore.RESET | ||
|
||
class Spawn(Building): | ||
def __init__(self, height, length, health): | ||
super().__init__(height, length, health) | ||
self.content = [[Fore.BLUE + 'S']*self.length for tile in range(self.height)] | ||
|
||
class TownHall(Building): | ||
def __init__(self, height, length, health): | ||
super().__init__(height, length, health) | ||
self.content = [[Fore.YELLOW + 'T']*self.length for tile in range(self.height)] | ||
|
||
class Hut(Building): | ||
def __init__(self, height, length, health): | ||
super().__init__(height, length, health) | ||
self.content = [[Fore.RED + 'H']*self.length for tile in range(self.height)] | ||
|
||
class Wall(Building): | ||
def __init__(self, height, length, health): | ||
super().__init__(height, length, health) | ||
self.content = [['X']*self.length for tile in range(self.height)] |
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