GameBox 0.0.5__tar.gz → 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. gamebox-0.1.0/PKG-INFO +20 -0
  2. gamebox-0.1.0/README.md +8 -0
  3. {gamebox-0.0.5 → gamebox-0.1.0}/pyproject.toml +1 -1
  4. gamebox-0.1.0/src/GameBox/__init__.py +28 -0
  5. gamebox-0.1.0/src/GameBox/_game.py +38 -0
  6. gamebox-0.1.0/src/GameBox/basics/_net.py +29 -0
  7. gamebox-0.1.0/src/GameBox/basics/_shapes.py +23 -0
  8. gamebox-0.1.0/src/GameBox/basics/cammera.py +30 -0
  9. gamebox-0.1.0/src/GameBox/basics/utils.py +17 -0
  10. gamebox-0.1.0/src/GameBox/player/_player.py +35 -0
  11. gamebox-0.1.0/src/GameBox/player/_playerControler.py +54 -0
  12. gamebox-0.1.0/src/GameBox/player/_playerPhysics.py +105 -0
  13. gamebox-0.1.0/tests/basicScreen.py +31 -0
  14. gamebox-0.0.5/PKG-INFO +0 -40
  15. gamebox-0.0.5/README.md +0 -28
  16. gamebox-0.0.5/src/GameBox/__init__.py +0 -37
  17. gamebox-0.0.5/src/GameBox/basics/Defaults.json +0 -12
  18. gamebox-0.0.5/src/GameBox/basics/Functions.py +0 -43
  19. gamebox-0.0.5/src/GameBox/basics/_core.py +0 -41
  20. gamebox-0.0.5/src/GameBox/basics/camera.py +0 -14
  21. gamebox-0.0.5/src/GameBox/basics/player.py +0 -284
  22. gamebox-0.0.5/src/GameBox/basics/shapes.py +0 -30
  23. gamebox-0.0.5/src/GameBox/entities/basicNPCs.py +0 -21
  24. gamebox-0.0.5/src/GameBox/entities/basicTypes.py +0 -79
  25. gamebox-0.0.5/src/GameBox/game.py +0 -30
  26. gamebox-0.0.5/src/GameBox/inputs/BasicInput.py +0 -11
  27. gamebox-0.0.5/src/GameBox/sound/BasicSound.py +0 -66
  28. gamebox-0.0.5/src/GameBox/tilemap/editor.py +0 -267
  29. gamebox-0.0.5/src/GameBox/tilemap/tilemap.py +0 -146
  30. gamebox-0.0.5/tests/SavedMap.json +0 -1
  31. gamebox-0.0.5/tests/TEST.py +0 -47
  32. gamebox-0.0.5/tests/player_movement.py +0 -20
  33. gamebox-0.0.5/tests/sprites/Ghost.png +0 -0
  34. gamebox-0.0.5/tests/sprites/image.png +0 -0
  35. gamebox-0.0.5/tests/sprites/playerSprite.png +0 -0
  36. {gamebox-0.0.5 → gamebox-0.1.0}/LICENSE +0 -0
  37. {gamebox-0.0.5 → gamebox-0.1.0}/src/GameBox/basics/__init__.py +0 -0
gamebox-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.4
2
+ Name: GameBox
3
+ Version: 0.1.0
4
+ Summary: GameBox is a beginner-friendly Python package built on top of pygame, designed to make 2D game development faster and easier. It provides ready-to-use modules, utilities, and abstractions that let new developers create polished games without needing advanced coding knowledge—while still offering the flexibility for experienced coders to customize and extend.
5
+ Author-email: Sam Fertig <sfertig007@gmail.com>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+
13
+ GameBox is a lightweight 2D game framework built on pygame.
14
+ This is an early technical preview of a full engine rewrite.
15
+ APIs may change frequently.
16
+
17
+ Versioning
18
+ GameBox follows a modified semantic versioning scheme.
19
+ Versions starting with 0.x.x are experimental and may change without notice.
20
+ Stable, marketed releases will begin at 1.0.0.
@@ -0,0 +1,8 @@
1
+ GameBox is a lightweight 2D game framework built on pygame.
2
+ This is an early technical preview of a full engine rewrite.
3
+ APIs may change frequently.
4
+
5
+ Versioning
6
+ GameBox follows a modified semantic versioning scheme.
7
+ Versions starting with 0.x.x are experimental and may change without notice.
8
+ Stable, marketed releases will begin at 1.0.0.
@@ -3,7 +3,7 @@ requires = ["hatchling >= 1.26"]
3
3
  build-backend = "hatchling.build"
4
4
  [project]
5
5
  name = "GameBox"
6
- version = "0.0.5"
6
+ version = "0.1.0"
7
7
  authors = [
8
8
  { name="Sam Fertig", email="sfertig007@gmail.com" },
9
9
  ]
@@ -0,0 +1,28 @@
1
+ """
2
+ GameBox - A beginner-friendly Python 2D game development library.
3
+ --------------------------------------------------------------
4
+ GameBox makes it easy to build 2D games with graphics, sound, and UI in just a few lines of code.
5
+ """
6
+
7
+
8
+ __version__ = "0.0.3"
9
+ __author__ = "Sam Fertig"
10
+
11
+ #____imports____
12
+ from ._game import Game
13
+ from .basics.cammera import Cammera
14
+ from .basics._shapes import Rect
15
+ from .player._player import Player
16
+ from .basics.utils import clamp, moveTward, zeroOut
17
+
18
+
19
+ __all__ = [
20
+ "Game",
21
+ "Cammera",
22
+ "Rect",
23
+ "Player",
24
+ "clamp",
25
+ "moveTward",
26
+ "zeroOut"
27
+ ]
28
+
@@ -0,0 +1,38 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from .basics._net import Global
5
+ from .player._player import Player
6
+
7
+ class Game:
8
+ def __init__(self, width, height, bg_color, WinTitle="GameBox"):
9
+ """
10
+ Initialize the Game object.
11
+
12
+ ParameArters:
13
+ width (int): The width of the game window.
14
+ height (int): The height of the game window.
15
+ bg_color (tuple): The background color of the game window.
16
+ WinTitle (str): The title of the game window.
17
+
18
+ Returns:
19
+ None
20
+ """
21
+ Global.screenDim = (width, height)
22
+ Global.screen = pygame.display.set_mode(Global.screenDim)
23
+ pygame.display.set_caption(WinTitle)
24
+ Global.bgColor = bg_color
25
+ Global.clock = pygame.time.Clock()
26
+ Global.game = self
27
+ self.objs = []
28
+
29
+ def update(self, frame_rate=60):
30
+ Global.collisions.clear()
31
+ Global.dt = Global.clock.tick(frame_rate) / 1000.0
32
+ Global.screen.fill(Global.bgColor)
33
+ player = None
34
+ for obj in self.objs:
35
+ if type(obj) == Player: player = obj
36
+ else: obj.update()
37
+ if player != None: player.update()
38
+ pygame.display.update()
@@ -0,0 +1,29 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ class _global_:
5
+ def __init__(self):
6
+ #screen info and win data
7
+ self.screen: pygame.Surface = None
8
+ self.dt: float = 0
9
+ self.screenDim: tuple = None
10
+ self.bgColor: tuple = None
11
+ self.clock: pygame.time.Clock = None
12
+
13
+ #basics
14
+ #--game and cam
15
+ self.game: object = None
16
+ self.cam: object = None
17
+ #-collisions
18
+ self.collisions: list[pygame.Rect] = []
19
+
20
+ #objects
21
+ self.player = self._player()
22
+
23
+ class _player:
24
+ def __init__(self):
25
+ self.pos: tuple = None
26
+
27
+
28
+
29
+ Global = _global_()
@@ -0,0 +1,23 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ..basics._net import Global
5
+
6
+ class Rect:
7
+ def __init__(self, pos: tuple, size: tuple, color: tuple = (0, 0, 0), collision: bool = True):
8
+ self.x, self.y = pos
9
+ self.width, self.height = size
10
+ self.color = color
11
+ Global.game.objs.append(self)
12
+ self.collision = collision
13
+
14
+ def update(self):
15
+ rect = pygame.Rect(self.x - Global.cam.x
16
+ , self.y - Global.cam.y
17
+ , self.width, self.height)
18
+ if self.collision: Global.collisions.append(rect)
19
+ pygame.draw.rect(Global.screen, self.color, rect)
20
+
21
+ def move(self, x, y):
22
+ self.x += x
23
+ self.y += y
@@ -0,0 +1,30 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ._net import Global
5
+
6
+ from ..basics.utils import moveTward
7
+
8
+ class Cammera:
9
+ def __init__(self):
10
+ self.x = 0
11
+ self.y = 0
12
+ Global.game.objs.append(self)
13
+ Global.cam = self
14
+ self.follow = None
15
+ self.diff = (0, 0)
16
+
17
+ def move(self, x, y):
18
+ self.x += x
19
+ self.y += y
20
+
21
+ def update(self):
22
+ return
23
+ if self.follow is not None:
24
+ self.x = (self.follow.x - self.diff[0])
25
+ self.y = (self.follow.y - self.diff[1])
26
+
27
+ def set_follow_target(self, target: object):
28
+ self.follow = target
29
+ print(target)
30
+ self.diff = (target.x - self.x, target.y - self.y)
@@ -0,0 +1,17 @@
1
+ import pygame
2
+ import math
3
+ import numpy as np
4
+
5
+ def clamp(value, min_value, max_value):
6
+ return max(min(value, max_value), min_value)
7
+ def moveTward(value, target, speed):
8
+ if value < target:
9
+ value += speed
10
+ elif value > target:
11
+ value -= speed
12
+ return value
13
+
14
+ def zeroOut(value, max):
15
+ if value < 0 and value > -max: value = 0
16
+ if value > 0 and value < max: value = 0
17
+ return value
@@ -0,0 +1,35 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ..basics._net import Global
5
+
6
+ from ..player._playerPhysics import _playerPhysics
7
+
8
+ class Player:
9
+ def __init__(self, pos: tuple, size: tuple, color: tuple = (0, 0, 0), gravity: bool = False):
10
+ self.x, self.y = pos
11
+ self.screenPos = pos
12
+ self.dim = size
13
+ self.color = color
14
+
15
+ self.gravity = gravity
16
+
17
+ Global.game.objs.append(self)
18
+ Global.player.pos = pos
19
+
20
+
21
+ def add_physics(self, speed: float = 1.0, gravity: float = 0.0, jump: float = 10.0, maxV: float = 10.0, airRes: float = 0.2):
22
+ self.physics = _playerPhysics(self, speed, gravity, jump, maxV, airRes)
23
+
24
+ def update(self):
25
+ self.physics.update()
26
+ #debug rect
27
+ rect = pygame.Rect(self.x, self.y, self.dim[0], self.dim[1])
28
+ pygame.draw.rect(Global.screen, "green", rect)
29
+
30
+ #movement
31
+ def top_down_movement(self):
32
+ self.physics.top_down_movement()
33
+
34
+ def platforming_movement(self):
35
+ self.physics.platforming_movement()
@@ -0,0 +1,54 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ..basics._net import Global
5
+ from ..basics.utils import clamp, moveTward, zeroOut
6
+
7
+ class _playerControler:
8
+ def __init__(self, player: object, speed: float = 1.0, gravity: float = 0.0, jump: float = 0.0, maxV: float = 10.0, airRes: float = 0.2):
9
+ self.speed = speed
10
+ self.gravity = gravity
11
+ self.jump = jump
12
+ self.player = player
13
+ self.maxV = maxV
14
+ self.airRes = airRes
15
+
16
+ def update(self):
17
+ self.player.vx = clamp(self.player.vx, -self.maxV, self.maxV)
18
+ #self.player.vy = clamp(self.player.vy, -self.maxV, self.maxV)
19
+
20
+ self.player.vx = moveTward(self.player.vx, 0, self.airRes)
21
+ self.player.vy = moveTward(self.player.vy, 0, self.airRes)
22
+
23
+ self.player.vx = zeroOut(self.player.vx, 0.3)
24
+ self.player.vy = zeroOut(self.player.vy, 0.3)
25
+
26
+ if self.player.gravity and not self.player.onGround: self.player.vy += self.gravity
27
+
28
+
29
+
30
+
31
+ def move(self, x, y):
32
+ self.player.vx += x * self.speed
33
+ self.player.vy += y * self.speed
34
+
35
+ def top_down_movement(self):
36
+ keys = pygame.key.get_pressed()
37
+ if keys[pygame.K_a]:
38
+ self.move(-1, 0)
39
+ if keys[pygame.K_d]:
40
+ self.move(1, 0)
41
+ if keys[pygame.K_w]:
42
+ self.move(0, -1)
43
+ if keys[pygame.K_s]:
44
+ self.move(0, 1)
45
+
46
+ def platforming_movement(self):
47
+ keys = pygame.key.get_pressed()
48
+ if keys[pygame.K_a]:
49
+ self.move(-1, 0)
50
+ if keys[pygame.K_d]:
51
+ self.move(1, 0)
52
+ if keys[pygame.K_SPACE] and self.player.onGround:
53
+ self.player.vy = -self.jump
54
+
@@ -0,0 +1,105 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ..basics._net import Global
5
+ from ..basics.utils import clamp, moveTward, zeroOut
6
+
7
+ class _playerPhysics:
8
+ def __init__(self, player, speed: float = 1.0, gravity: float = 0.0, jump: float = 0.0, maxV: float = 10.0, airRes: float = 0.2):
9
+ self.player = player
10
+ self.rect = pygame.Rect(self.player.x, self.player.y, self.player.dim[0], self.player.dim[1])
11
+
12
+ self.speed = speed
13
+ self.gravity = gravity
14
+ self.jump = jump
15
+ self.player = player
16
+ self.maxV = maxV
17
+ self.airRes = airRes
18
+ self.onGround = False
19
+ self.canJump = False
20
+
21
+ self.vx, self.vy = 0, 0
22
+
23
+ def update(self):
24
+ self.ckeck_is_on_ground()
25
+ self.fixVelocities()
26
+ x, y = self.check_collisions()
27
+ if type(Global.cam.follow) != type(self.player):
28
+ self.player.x = x
29
+ self.player.y = y
30
+ elif type(Global.cam.follow) == type(self.player):
31
+ dx = -(self.player.x - x)
32
+ dy = -(self.player.y - y)
33
+ Global.cam.move(self.vx, self.vy)
34
+
35
+
36
+
37
+ def check_collisions(self):
38
+ x, y = self.player.x + self.vx, self.player.y + self.vy
39
+
40
+ # X-axis collisions
41
+ new_rect = pygame.Rect((x, self.player.y), self.player.dim)
42
+ for collision in Global.collisions:
43
+ if collision.colliderect(new_rect):
44
+ if self.vx > 0:
45
+ x = collision.left - self.player.dim[0]
46
+ elif self.vx < 0:
47
+ x = collision.right
48
+ self.vx = 0
49
+
50
+ # Y-axis collisions
51
+ new_rect = pygame.Rect((x, y), self.player.dim)
52
+ for collision in Global.collisions:
53
+ if collision.colliderect(new_rect):
54
+ if self.vy > 0: # falling
55
+ y = collision.top - self.player.dim[1]
56
+ self.vy = 0
57
+ elif self.vy < 0: # jumping
58
+ y = collision.bottom
59
+ self.vy = 0
60
+
61
+ return x, y
62
+
63
+ def ckeck_is_on_ground(self):
64
+ self.canJump = False
65
+ rect = pygame.Rect(self.player.x, self.player.y + self.player.dim[1], self.player.dim[0], 10)
66
+ for collision in Global.collisions:
67
+ if collision.colliderect(rect):
68
+ self.canJump = True
69
+
70
+
71
+ def move(self, x, y):
72
+ self.vx += x * self.speed
73
+ self.vy += y * self.speed
74
+
75
+ def top_down_movement(self):
76
+ keys = pygame.key.get_pressed()
77
+ if keys[pygame.K_a]:
78
+ self.move(-1, 0)
79
+ if keys[pygame.K_d]:
80
+ self.move(1, 0)
81
+ if keys[pygame.K_w]:
82
+ self.move(0, -1)
83
+ if keys[pygame.K_s]:
84
+ self.move(0, 1)
85
+ #limit velocity
86
+ self.vx = clamp(self.vx, -self.maxV, self.maxV)
87
+ self.vy = clamp(self.vy, -self.maxV, self.maxV)
88
+ self.vx = moveTward(self.vx, 0, self.airRes)
89
+ self.vy = moveTward(self.vy, 0, self.airRes)
90
+ self.vx = zeroOut(self.vx, 0.3)
91
+ self.vy = zeroOut(self.vy, 0.3)
92
+
93
+ def platforming_movement(self):
94
+ keys = pygame.key.get_pressed()
95
+ if keys[pygame.K_a]:
96
+ self.move(-1, 0)
97
+ if keys[pygame.K_d]:
98
+ self.move(1, 0)
99
+ if keys[pygame.K_w] and self.canJump:
100
+ self.vy -= self.jump
101
+ #limit velocity
102
+ self.vx = clamp(self.vx, -self.maxV, self.maxV)
103
+ self.vx = moveTward(self.vx, 0, self.airRes)
104
+ self.vx = zeroOut(self.vx, 0.3)
105
+ if self.player.gravity and not self.onGround: self.vy += self.gravity
@@ -0,0 +1,31 @@
1
+ from src.GameBox import *
2
+ import pygame
3
+
4
+ width, height = 1400, 800
5
+ game = Game(width, height, (124, 204, 201))
6
+
7
+ cam = Cammera()
8
+
9
+ player = Player((width / 2, 500), (50, 50), (0, 255, 0), True)
10
+
11
+ player.add_physics(1.0, 3.0, 16, 7.0, 0.5)
12
+
13
+ rect = Rect((0, 700), (width*20, 100), (255, 0, 0), True)
14
+
15
+ cam.set_follow_target(player)
16
+
17
+ running = True
18
+
19
+ while running:
20
+ for event in pygame.event.get():
21
+ if event.type == pygame.QUIT:
22
+ running = False
23
+
24
+ player.platforming_movement()
25
+
26
+ game.update()
27
+
28
+
29
+
30
+ pygame.quit()
31
+ quit()
gamebox-0.0.5/PKG-INFO DELETED
@@ -1,40 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: GameBox
3
- Version: 0.0.5
4
- Summary: GameBox is a beginner-friendly Python package built on top of pygame, designed to make 2D game development faster and easier. It provides ready-to-use modules, utilities, and abstractions that let new developers create polished games without needing advanced coding knowledge—while still offering the flexibility for experienced coders to customize and extend.
5
- Author-email: Sam Fertig <sfertig007@gmail.com>
6
- License-Expression: MIT
7
- License-File: LICENSE
8
- Classifier: Operating System :: OS Independent
9
- Classifier: Programming Language :: Python :: 3
10
- Requires-Python: >=3.9
11
- Description-Content-Type: text/markdown
12
-
13
- # GameBox 🎮
14
- *A beginner-friendly game framework built on top of pygame.*
15
-
16
- ## Overview
17
- GameBox is a Python package designed to make **2D game design simple, fast, and fun**.
18
- It extends **pygame** with pre-built modules, utilities, and helpers that allow beginners to build advanced-looking games without needing to write tons of boilerplate code.
19
-
20
- Whether you’re just starting out or you’re an experienced developer who wants to prototype quickly, GameBox has you covered.
21
-
22
- 👉 **Docs & Examples:** [GameBox Documentation](https://sites.google.com/view/pythonpackagegamebox/)
23
-
24
- ---
25
-
26
- ## Features ✨
27
- - Built on top of **pygame** for reliability and performance
28
- - Easy-to-use modules for sprites, input handling, collisions, animations, and more
29
- - Reduces boilerplate: get a game loop running in just a few lines
30
- - Beginner-friendly design with advanced flexibility
31
- - Helps you focus on *gameplay* instead of low-level setup
32
-
33
- ---
34
-
35
- ## Installation
36
- GameBox requires Python 3.8+ and pygame.
37
- You can install it using pip:
38
-
39
- ```bash
40
- pip install GameBox
gamebox-0.0.5/README.md DELETED
@@ -1,28 +0,0 @@
1
- # GameBox 🎮
2
- *A beginner-friendly game framework built on top of pygame.*
3
-
4
- ## Overview
5
- GameBox is a Python package designed to make **2D game design simple, fast, and fun**.
6
- It extends **pygame** with pre-built modules, utilities, and helpers that allow beginners to build advanced-looking games without needing to write tons of boilerplate code.
7
-
8
- Whether you’re just starting out or you’re an experienced developer who wants to prototype quickly, GameBox has you covered.
9
-
10
- 👉 **Docs & Examples:** [GameBox Documentation](https://sites.google.com/view/pythonpackagegamebox/)
11
-
12
- ---
13
-
14
- ## Features ✨
15
- - Built on top of **pygame** for reliability and performance
16
- - Easy-to-use modules for sprites, input handling, collisions, animations, and more
17
- - Reduces boilerplate: get a game loop running in just a few lines
18
- - Beginner-friendly design with advanced flexibility
19
- - Helps you focus on *gameplay* instead of low-level setup
20
-
21
- ---
22
-
23
- ## Installation
24
- GameBox requires Python 3.8+ and pygame.
25
- You can install it using pip:
26
-
27
- ```bash
28
- pip install GameBox
@@ -1,37 +0,0 @@
1
- """
2
- GameBox - A beginner-friendly Python 2D game development library.
3
- --------------------------------------------------------------
4
- GameBox makes it easy to build 2D games with graphics, sound, and UI in just a few lines of code.
5
- """
6
-
7
-
8
- __version__ = "0.0.3"
9
- __author__ = "Sam Fertig"
10
-
11
- #____imports____
12
- from .game import Game
13
- from .basics.camera import Camera
14
- from .basics.shapes import Rect, Text
15
- from .basics.player import Player, Animation
16
- from .tilemap.tilemap import Tilemap
17
- from .inputs.BasicInput import Input
18
- from .sound.BasicSound import Sound
19
- from .basics.Functions import State_conditions
20
- from .entities.basicTypes import Static_enemy, Dynamic_enemy
21
-
22
-
23
- __all__ = [
24
- "Game",
25
- "Camera",
26
- "Rect",
27
- "Player",
28
- "Tilemap",
29
- "Input",
30
- "Sound",
31
- "Text",
32
- "Animation",
33
- "State_conditions",
34
- "Static_enemy",
35
- "Dynamic_enemy",
36
- ]
37
-
@@ -1,12 +0,0 @@
1
- {
2
-
3
- "tilemap": {
4
- "tile_size": 32,
5
- "highlight_color": [0, 255, 0],
6
- "collision_color": [255, 0, 0],
7
- "grid_line_color": [100, 100, 100],
8
- "layer_opacity": 0.8,
9
- "snap_to_grid": true
10
- }
11
-
12
- }
@@ -1,43 +0,0 @@
1
- import pygame
2
-
3
- def DisplayText(text, color, size, pos, screen):
4
- font = pygame.font.Font(None, size)
5
- textSurf = font.render(text, False, color)
6
- screen.blit(textSurf, pos)
7
-
8
- def getTilePosInGrid(pos, grid_size):
9
- x, y = pos
10
- return (x // grid_size, y // grid_size)
11
-
12
- class IsWithinBounds:
13
- def __init__(self, dim, offset):
14
- self.offset = offset
15
- self.dim = dim
16
-
17
- def checkPos(self, pos):
18
- x, y = pos
19
- w, h = self.dim
20
- w+=self.offset
21
- h+=self.offset
22
- if x > w or y > h:
23
- return False
24
- w=-self.offset
25
- h=-self.offset
26
- if x < w or y < h:
27
- return False
28
- return True
29
-
30
- class State_conditions:
31
- def __init__(self):
32
- self.top = "C^"
33
- self.bottom = "C_"
34
- self.left = "C<"
35
- self.right = "C>"
36
- self.any = "C#"
37
- self.none = "CN"
38
- self.move_up = "M^"
39
- self.move_down = "M_"
40
- self.move_left = "m<"
41
- self.move_right = "M>"
42
- self.move_any = "M#"
43
- self.move_none = "MN"
@@ -1,41 +0,0 @@
1
- import json
2
- import os
3
-
4
- class _GLOBALNETWORK:
5
- def __init__(self):
6
- self.collisions = []
7
- self.playerPosition = None
8
- self.BaseInfo = {}
9
- self.screen = None
10
-
11
- class _CONFIG:
12
- def __init__(self, path="Defaults.json"):
13
- self.data = {}
14
- self.load(path)
15
-
16
- def load(self, path):
17
- """Load JSON data with fallback defaults."""
18
- if not os.path.exists(path):
19
- print("[GameBox] No Default.json found — using override settings.")
20
- return
21
-
22
- with open(path, "r") as f:
23
- try:
24
- self.data = json.load(f)
25
- print("[GameBox] Config loaded successfully.")
26
- except json.JSONDecodeError:
27
- print("[GameBox] Error: Invalid JSON format.")
28
-
29
- def get(self, *keys, default=None):
30
- """Nested key access: config.get('player', 'speed')"""
31
- ref = self.data
32
- for key in keys:
33
- if isinstance(ref, dict) and key in ref:
34
- ref = ref[key]
35
- else:
36
- return default
37
- return ref
38
-
39
-
40
-
41
- GLOBAL = _GLOBALNETWORK()
@@ -1,14 +0,0 @@
1
- import pygame
2
-
3
- class Camera:
4
- def __init__(self, width, height, type = "dynamic"):
5
- """Camera type can be fixed or dynamic depending on your needs. Defaults to dynamic."""
6
- self.type = type
7
- self.dim = width, height
8
- self.pos = 0, 0
9
-
10
- def move(self, x, y):
11
- X, Y = self.pos
12
- X+=x
13
- Y+=y
14
- self.pos = X, Y