-
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.
initial commit with base structure of the project
- Loading branch information
1 parent
d5e9445
commit 462c4f2
Showing
23 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,22 @@ | ||
from src.Game import Game | ||
from src.AI import AIRaffaele, AIRoberto | ||
import pygame | ||
pygame.init() | ||
|
||
WIDTH, HEIGHT = 1080, 720 | ||
BG_COLOR = (0, 0, 0) # default is (0, 150, 150) | ||
BG = pygame.Surface((WIDTH, HEIGHT)) | ||
BG.fill(BG_COLOR) # set screen with background color | ||
FPS = 1 | ||
CLOCK = pygame.time.Clock() | ||
SCREEN = pygame.display.set_mode((WIDTH, HEIGHT)) | ||
pygame.display.set_caption("Stick-Man A.I.") | ||
|
||
|
||
def main(): | ||
partita = Game(SCREEN, CLOCK, [AIRaffaele, AIRoberto]) | ||
partita.start() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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,3 @@ | ||
class AIBase: | ||
def __init__(self): | ||
pass |
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,6 @@ | ||
from src.AI.AIBase import AIBase | ||
|
||
|
||
class AIRaffaele(AIBase): | ||
def __init__(self): | ||
super().__init__() |
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,6 @@ | ||
from src.AI.AIBase import AIBase | ||
|
||
|
||
class AIRoberto(AIBase): | ||
def __init__(self): | ||
super().__init__() |
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,2 @@ | ||
from src.AI.AIRaffaele import AIRaffaele | ||
from src.AI.AIRoberto import AIRoberto |
Binary file not shown.
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,3 @@ | ||
class Environment: | ||
def __init__(self): | ||
pass |
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,38 @@ | ||
import random | ||
from src.Game.Player import Player | ||
import pygame | ||
|
||
|
||
class Game: | ||
def __init__(self, screen, clock, AIs): | ||
self.screen: pygame.Surface = screen | ||
self.clock = clock | ||
rand = random.choice([1, 0]) # alternate between player 1 and 2 | ||
self.player_1 = Player(AIs[0], rand) | ||
self.player_2 = Player(AIs[1], 1-rand) | ||
|
||
def start(self): | ||
self.game_loop() | ||
|
||
def draw_background(self): | ||
pygame.draw.line(self.screen, (0, 255, 255), (0, 480), (1080, 480)) | ||
|
||
def draw_hud(self): | ||
pass | ||
|
||
def refresh(self): | ||
self.draw_background() | ||
self.player_1.draw(self.screen) | ||
self.player_2.draw(self.screen) | ||
self.draw_hud() | ||
pygame.display.update() | ||
|
||
def game_loop(self): | ||
while True: | ||
for event in pygame.event.get(): | ||
if event.type == pygame.QUIT: | ||
exit() | ||
"""elif event.type == pygame.MOUSEBUTTONUP and event.button == 1: # mouse click | ||
pass""" | ||
self.refresh() | ||
self.clock.tick(30) |
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,6 @@ | ||
class HUD: | ||
def __init__(self, num): | ||
self.number = num | ||
|
||
def draw(self, screen): | ||
pass |
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,10 @@ | ||
from src.Game.HUD import HUD | ||
|
||
|
||
class Player: | ||
def __init__(self, ai, num): | ||
self.AI = ai | ||
self.HUD = HUD(num) | ||
|
||
def draw(self, screen): | ||
self.HUD.draw(screen) |
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 @@ | ||
from src.Game.Game import Game |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.