diff options
author | Viljami Ilola <+@hix.fi> | 2024-04-09 01:54:49 +0300 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-04-09 01:54:49 +0300 |
commit | 7a97b9c7a779aa7739e743770559ca7146ba6df3 (patch) | |
tree | 2b4f917a2187e74b27e0a272a8d15c48fd41f60f | |
parent | 5981707f152b4e611abb50a6975a44548844117a (diff) |
use namespace package in importsv0.3b2
31 files changed, 53 insertions, 59 deletions
diff --git a/pyproject.toml b/pyproject.toml index d2dbd5e..1ce463f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,9 +2,12 @@ name = "sliceitoff" version = "0.3-beta.1" description = "Arcade game where one slices play area off avoiding enemies." +repository = "https://git.hix.fi/sliceitoff.git/" authors = ["Viljami Ilola <+@hix.fi>"] readme = "README.txt" -packages = [{include = "sliceitoff", from = "src"}] +packages = [ + {include = "sliceitoff", from = "src"}, +] [tool.poetry.dependencies] python = "^3.10" diff --git a/src/sliceitoff/__main__.py b/src/sliceitoff/__main__.py deleted file mode 100644 index 971e58c..0000000 --- a/src/sliceitoff/__main__.py +++ /dev/null @@ -1,8 +0,0 @@ -""" Slice It Off! - Game where you slice the area where enemies reside to - the minimum -""" - -from game import Game - -game = Game() -game.run() diff --git a/src/sliceitoff/enemies/ball.py b/src/sliceitoff/enemies/ball.py index b8c8467..91a43df 100644 --- a/src/sliceitoff/enemies/ball.py +++ b/src/sliceitoff/enemies/ball.py @@ -1,7 +1,7 @@ """ enemies.ball - Enemy type that goes straight line hitting walls """ from random import randrange, choice -from text import get_letter_surface +from sliceitoff.text import get_letter_surface from .enemy import Enemy BALL_SPAWN_AREA = (0, 0, 300_000, 200_000) diff --git a/src/sliceitoff/enemies/bouncher.py b/src/sliceitoff/enemies/bouncher.py index 692492b..a10f204 100644 --- a/src/sliceitoff/enemies/bouncher.py +++ b/src/sliceitoff/enemies/bouncher.py @@ -1,7 +1,7 @@ """ enemies.bouncher - Enemy type that bouches around """ from random import randrange, choice -from text import get_letter_surface +from sliceitoff.text import get_letter_surface from .enemy import Enemy BOUNCHER_SPAWN_AREA = (0, 0, 300_000, 80_000) diff --git a/src/sliceitoff/enemies/enemy.py b/src/sliceitoff/enemies/enemy.py index 08d75dd..600ea26 100644 --- a/src/sliceitoff/enemies/enemy.py +++ b/src/sliceitoff/enemies/enemy.py @@ -1,7 +1,7 @@ """ enemy.enemy - Enemy super class. Wall hitting and other commons """ import pygame -from display import Scaling +from sliceitoff.display import Scaling class Enemy(pygame.sprite.Sprite): """ Enemy super class. Just common movements. """ diff --git a/src/sliceitoff/field/field.py b/src/sliceitoff/field/field.py index 27f4ceb..95a2aeb 100644 --- a/src/sliceitoff/field/field.py +++ b/src/sliceitoff/field/field.py @@ -4,8 +4,8 @@ from random import randrange, choice import pygame -from display import Scaling, CGA_COLORS -from text import LetterSprite +from sliceitoff.display import Scaling, CGA_COLORS +from sliceitoff.text import LetterSprite DEBUG = os.getenv("DEBUG") diff --git a/src/sliceitoff/game/game.py b/src/sliceitoff/game/game.py index 9afe342..3404fd3 100644 --- a/src/sliceitoff/game/game.py +++ b/src/sliceitoff/game/game.py @@ -6,15 +6,15 @@ from pathlib import Path import pygame -from display import Display -from text import Fonts -from stats import Stats -from screens import ( +from sliceitoff.display import Display +from sliceitoff.text import Fonts +from sliceitoff.stats import Stats +from sliceitoff.screens import ( hiscores_screen, instructions1_screen, instructions2_screen) -from hiscores import HiScores -from mainmenu import Mainmenu, MenuItems +from sliceitoff.hiscores import HiScores +from sliceitoff.mainmenu import Mainmenu, MenuItems from .level import Level from .show import Show diff --git a/src/sliceitoff/game/initials.py b/src/sliceitoff/game/initials.py index 9fb5a68..385562c 100644 --- a/src/sliceitoff/game/initials.py +++ b/src/sliceitoff/game/initials.py @@ -1,7 +1,7 @@ """ game.initials - Use will be asked for initials """ import pygame -from screens import initials_screen +from sliceitoff.screens import initials_screen from .explodeout import ExplodeOutGroup diff --git a/src/sliceitoff/game/level.py b/src/sliceitoff/game/level.py index 845c960..c3713ce 100644 --- a/src/sliceitoff/game/level.py +++ b/src/sliceitoff/game/level.py @@ -1,11 +1,11 @@ """ game.level - This is what runs invidual levels """ import pygame -from status import Status -from player import Player, Life -from field import Field -from enemies import Enemies -from screens import levelup_screen, gameover_screen, level_screen +from sliceitoff.status import Status +from sliceitoff.player import Player, Life +from sliceitoff.field import Field +from sliceitoff.enemies import Enemies +from sliceitoff.screens import levelup_screen, gameover_screen, level_screen from .gameplay import Gameplay from .show import Show diff --git a/src/sliceitoff/hiscores/hiscores.py b/src/sliceitoff/hiscores/hiscores.py index 4b71c1a..372db31 100644 --- a/src/sliceitoff/hiscores/hiscores.py +++ b/src/sliceitoff/hiscores/hiscores.py @@ -11,7 +11,7 @@ class HiScores: self.table=[] if os.name == 'nt': self.config_filename = os.path.join(Path.home(), "sliceitoff.cfg") - else: + else: self.config_filename = os.path.join( Path.home(), ".config", diff --git a/src/sliceitoff/main.py b/src/sliceitoff/main.py index 58cc617..9a95b05 100644 --- a/src/sliceitoff/main.py +++ b/src/sliceitoff/main.py @@ -1,11 +1,10 @@ """ main.py """ -from runpy import run_path -from pathlib import Path +from sliceitoff.game import Game def main(): - """ Let's start the app as current path being base """ - my_path = Path(__file__).parent.resolve() - run_path(f"{my_path}", run_name="sliceitoff") + """ All the fun begins here """ + game = Game() + game.run() if __name__ == "__main__": main() diff --git a/src/sliceitoff/mainmenu/mainmenu.py b/src/sliceitoff/mainmenu/mainmenu.py index 7d52cd8..d747f7d 100644 --- a/src/sliceitoff/mainmenu/mainmenu.py +++ b/src/sliceitoff/mainmenu/mainmenu.py @@ -2,10 +2,10 @@ from enum import IntEnum import pygame -from screens import mainmenu_screen -from display import Scaling +from sliceitoff.screens import mainmenu_screen +from sliceitoff.display import Scaling -from game.explodeout import ExplodeOutGroup +from sliceitoff.game.explodeout import ExplodeOutGroup MOUSE_TRESHOLD = 100 diff --git a/src/sliceitoff/player/life.py b/src/sliceitoff/player/life.py index ef39869..16ba052 100644 --- a/src/sliceitoff/player/life.py +++ b/src/sliceitoff/player/life.py @@ -1,9 +1,8 @@ """ player.life - Hearth that will explode """ import pygame -from display import Scaling - -from text import get_letter_surface, ExplodingSprite +from sliceitoff.display import Scaling +from sliceitoff.text import get_letter_surface, ExplodingSprite class PieceOfHearth(ExplodingSprite): """ Eploding piece. Hearth consist of these """ diff --git a/src/sliceitoff/player/player.py b/src/sliceitoff/player/player.py index 82cc9a4..1d6ede7 100644 --- a/src/sliceitoff/player/player.py +++ b/src/sliceitoff/player/player.py @@ -2,7 +2,7 @@ import os import pygame -from display import Scaling +from sliceitoff.display import Scaling from .static import SLICER diff --git a/src/sliceitoff/player/static.py b/src/sliceitoff/player/static.py index 415f1cd..f965570 100644 --- a/src/sliceitoff/player/static.py +++ b/src/sliceitoff/player/static.py @@ -1,6 +1,7 @@ """ player.static - static data related to player - now just slicer """ from dataclasses import dataclass -from display import CGA_COLORS + +from sliceitoff.display import CGA_COLORS @dataclass class SLICER: diff --git a/src/sliceitoff/screens/gameover.py b/src/sliceitoff/screens/gameover.py index aac4b22..daf5ded 100644 --- a/src/sliceitoff/screens/gameover.py +++ b/src/sliceitoff/screens/gameover.py @@ -1,5 +1,5 @@ """ screen.gameover - screen to be displayer game over situation """ -from text import TextPage +from sliceitoff.text import TextPage def gameover_screen(): """ gameover_screen - overlay top of ended gameplay """ diff --git a/src/sliceitoff/screens/hiscores.py b/src/sliceitoff/screens/hiscores.py index c73f0bf..a0dbb39 100644 --- a/src/sliceitoff/screens/hiscores.py +++ b/src/sliceitoff/screens/hiscores.py @@ -1,5 +1,5 @@ """ screens.hiscores - Defines how to display hiscore text on the screen """ -from text import TextPage +from sliceitoff.text import TextPage def hiscores_screen(score_text): """ hiscores_screen - only ajustments to hiscore text """ diff --git a/src/sliceitoff/screens/initials.py b/src/sliceitoff/screens/initials.py index 632cfa4..9b0cc2c 100644 --- a/src/sliceitoff/screens/initials.py +++ b/src/sliceitoff/screens/initials.py @@ -1,6 +1,6 @@ """ screens.initials - screen where input initials when one makes to hiscores """ -from text import TextPage +from sliceitoff.text import TextPage def initials_screen(name): """ initials_screen - screen where name is updating as user imputs """ diff --git a/src/sliceitoff/screens/instructions1.py b/src/sliceitoff/screens/instructions1.py index 58d6f58..cf9ccc7 100644 --- a/src/sliceitoff/screens/instructions1.py +++ b/src/sliceitoff/screens/instructions1.py @@ -1,5 +1,5 @@ """ screens.instructions1 - First page of instructions""" -from text import TextPage +from sliceitoff.text import TextPage def instructions1_screen(): """ Instructions about the goal """ diff --git a/src/sliceitoff/screens/instructions2.py b/src/sliceitoff/screens/instructions2.py index 19b8928..9d9923f 100644 --- a/src/sliceitoff/screens/instructions2.py +++ b/src/sliceitoff/screens/instructions2.py @@ -1,5 +1,5 @@ """ screens.instructions2 - Page about scoring """ -from text import TextPage +from sliceitoff.text import TextPage def instructions2_screen(): """ Instructions about scoring """ diff --git a/src/sliceitoff/screens/level.py b/src/sliceitoff/screens/level.py index d3a60f8..0a89df7 100644 --- a/src/sliceitoff/screens/level.py +++ b/src/sliceitoff/screens/level.py @@ -1,5 +1,5 @@ """ screens.level - Screen to be shown when level begins. """ -from text import TextPage +from sliceitoff.text import TextPage def level_screen(level): """ level_screen - displays level number """ diff --git a/src/sliceitoff/screens/levelup.py b/src/sliceitoff/screens/levelup.py index 25cb1b9..8a66156 100644 --- a/src/sliceitoff/screens/levelup.py +++ b/src/sliceitoff/screens/levelup.py @@ -1,5 +1,5 @@ """ screen.levelup - Screen to show after succesfully completing level """ -from text import TextPage +from sliceitoff.text import TextPage def levelup_screen(stats = None): """ levelup_screen - screen full of stats how bonus is calculated """ diff --git a/src/sliceitoff/screens/mainmenu.py b/src/sliceitoff/screens/mainmenu.py index 8e1f876..17def9a 100644 --- a/src/sliceitoff/screens/mainmenu.py +++ b/src/sliceitoff/screens/mainmenu.py @@ -1,6 +1,6 @@ """ screens.mainmenu - Screen for mainmenu""" from random import randrange -from text import TextPage +from sliceitoff.text import TextPage def mainmenu_screen(selection): """ Screen where current selection is flashing """ diff --git a/src/sliceitoff/status/status.py b/src/sliceitoff/status/status.py index 8a1a130..f018778 100644 --- a/src/sliceitoff/status/status.py +++ b/src/sliceitoff/status/status.py @@ -1,7 +1,7 @@ """ status.status - The statusline bottom of screen showinf all stats """ import pygame -from text import TextPage +from sliceitoff.text import TextPage class Status(pygame.sprite.Group): """ Statusline bottom of screen """ diff --git a/src/sliceitoff/text/explode.py b/src/sliceitoff/text/explode.py index 4925398..aca1489 100644 --- a/src/sliceitoff/text/explode.py +++ b/src/sliceitoff/text/explode.py @@ -3,7 +3,7 @@ from random import randrange import pygame -from display import Scaling +from sliceitoff.display import Scaling class ExplodingSprite(pygame.sprite.Sprite): """ Just adds exloding movement to the sprite """ diff --git a/src/sliceitoff/text/text.py b/src/sliceitoff/text/text.py index 69fee77..3dafa64 100644 --- a/src/sliceitoff/text/text.py +++ b/src/sliceitoff/text/text.py @@ -1,7 +1,7 @@ """ text.text - letters, texts and scaling and coloring of fonts """ import pygame -from display import Scaling, CGA_COLORS +from sliceitoff.display import Scaling, CGA_COLORS from .fonts import Fonts from .explode import ExplodingSprite diff --git a/tests/test_display.py b/tests/test_display.py index 5e01038..c61c262 100644 --- a/tests/test_display.py +++ b/tests/test_display.py @@ -2,7 +2,7 @@ import unittest import pygame -from display import Display +from sliceitoff.display import Display class TestDisplay(unittest.TestCase): def test_can_create(self): diff --git a/tests/test_enemies.py b/tests/test_enemies.py index 5182ea2..994ab77 100644 --- a/tests/test_enemies.py +++ b/tests/test_enemies.py @@ -5,9 +5,9 @@ import pygame from pathlib import Path -from enemies.enemies import EnemyBall, Enemies -from display import Scaling -from text import Fonts +from sliceitoff.enemies.enemies import EnemyBall, Enemies +from sliceitoff.display import Scaling +from sliceitoff.text import Fonts class TestEnemyBall(unittest.TestCase): def setUp(self): diff --git a/tests/test_scaling.py b/tests/test_scaling.py index 170dbab..ece1e16 100644 --- a/tests/test_scaling.py +++ b/tests/test_scaling.py @@ -1,6 +1,6 @@ import unittest -from display import Scaling, INTERNAL_HEIGHT, INTERNAL_WIDTH +from sliceitoff.display import Scaling, INTERNAL_HEIGHT, INTERNAL_WIDTH class TestScaling(unittest.TestCase): def test_update_scaling(self): diff --git a/tests/test_screens.py b/tests/test_screens.py index a81bc33..a95894b 100644 --- a/tests/test_screens.py +++ b/tests/test_screens.py @@ -3,9 +3,9 @@ import unittest from pathlib import Path -from text import Fonts, TextPage +from sliceitoff.text import Fonts, TextPage -from screens import ( +from sliceitoff.screens import ( gameover_screen, hiscores_screen, initials_screen, diff --git a/tests/test_text.py b/tests/test_text.py index c4f51fd..6db0723 100644 --- a/tests/test_text.py +++ b/tests/test_text.py @@ -3,7 +3,7 @@ import unittest from pathlib import Path -from text import Fonts, TextPage +from sliceitoff.text import Fonts, TextPage class TestText(unittest.TestCase): def setUp(self): |