GameBox 0.2.0__py3-none-any.whl → 0.9.0__py3-none-any.whl

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.
@@ -0,0 +1,39 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ..basics._net import Global
5
+
6
+ class Animation:
7
+ def __init__(self, image, tileDim, startPos, frames, dur):
8
+ if type(image) == str:
9
+ image = pygame.image.load(image)
10
+
11
+ #others
12
+ self.dur = dur
13
+ self.currentFrame = 0
14
+ self.currentDur = 0
15
+
16
+ #get frames from image
17
+ self.frames = []
18
+ x, y = startPos
19
+ x *= tileDim[0]
20
+ y *= tileDim[1]
21
+ for i in range(frames):
22
+ self.frames.append(image.subsurface(x, y, tileDim[0], tileDim[1]))
23
+ x += tileDim[0]
24
+ if x >= image.get_width():
25
+ x = 0
26
+ y += tileDim[1]
27
+
28
+ def update(self, dt):
29
+ self.currentDur += dt
30
+ if self.currentDur >= self.dur:
31
+ self.currentDur = 0
32
+ self.currentFrame += 1
33
+ if self.currentFrame >= len(self.frames):
34
+ self.currentFrame = 0
35
+
36
+ def getFrame(self):
37
+ return self.frames[self.currentFrame]
38
+
39
+
@@ -0,0 +1,243 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ..basics._net import Global
5
+ from ._Animations import Animation
6
+
7
+ class Sprite_2d:
8
+ def __init__(self, pos: tuple, image, scale: float = 1.0, collision = True, dirrection: int = 1):
9
+ """
10
+ Initialize a 2D sprite.
11
+
12
+ Args:
13
+ pos: Tuple (x, y) for the sprite position
14
+ image: Either a file path (str) or pygame.Surface object
15
+ scale: Scale factor for the sprite (default: 1.0)
16
+ """
17
+ #add to game
18
+ Global.game.objs.append(self)
19
+ self.collision = collision
20
+ self.__worldPos__ = True
21
+ self.dir = dirrection
22
+
23
+ self.pos = pos
24
+ if type(image) == str:
25
+ self.image = pygame.image.load(image)
26
+ else:
27
+ self.image = image
28
+
29
+ #scale image
30
+ print(self.image)
31
+ self.image = pygame.transform.scale_by(self.image, scale)
32
+ #flip image
33
+ if self.dir == -1:
34
+ self.image = pygame.transform.flip(self.image, True, False)
35
+
36
+ def update(self):
37
+ #world space
38
+ x, y = self.pos
39
+ if self.__worldPos__:
40
+ x = x - Global.cam.x
41
+ y = y - Global.cam.y
42
+ Global.screen.blit(self.image, (x, y))
43
+ if self.collision:
44
+ rect = self.image.get_rect()
45
+ rect.x = x
46
+ rect.y = y
47
+ Global.collisions.append(rect)
48
+
49
+ def switch_dirrection(self):
50
+ self.image = pygame.transform.flip(self.image, True, False)
51
+
52
+
53
+ def move_by(self, x: int, y: int):
54
+ self.pos = (self.pos[0] + x, self.pos[1] + y)
55
+
56
+ def move_to(self, x: int, y: int):
57
+ self.pos = (x, y)
58
+
59
+ def get_pos(self):
60
+ return self.pos
61
+
62
+ def rescale(self, scale: float):
63
+ self.image = pygame.transform.scale_by(self.image, scale)
64
+
65
+ def __remove__(self):
66
+ Global.game.objs.remove(self)
67
+
68
+ def split_image(image, tileDim, startPos):
69
+ if type(image) == str:
70
+ image = pygame.image.load(image)
71
+ else:
72
+ image = image
73
+
74
+ #return image split
75
+ x = startPos[0] * tileDim[0]
76
+ y = startPos[1] * tileDim[1]
77
+ return image.subsurface((x, y, tileDim[0], tileDim[1]))
78
+
79
+ class Animated_Sprite2D:
80
+ """
81
+ A class for animated 2D sprites.
82
+
83
+ Args:
84
+ pos (tuple): The position of the sprite in world space.
85
+ image (str or pygame.Surface): The image of the sprite.
86
+ imageDim (tuple): The dimensions of the image.
87
+ tileDim (tuple): The dimensions of the tiles in the image.
88
+ frames (int): The number of frames in the animation.
89
+ speed (float): The speed of the animation.
90
+ scale (float): The scale of the sprite.
91
+ collision (bool): Whether the sprite has collision.
92
+ dirrection (int): The direction of the sprite.
93
+
94
+ Attributes:
95
+ animation (Animation): The animation of the sprite.
96
+ collision (bool): Whether the sprite has collision.
97
+ dir (int): The direction of the sprite.
98
+ pos (tuple): The position of the sprite in world space.
99
+ scale (float): The scale of the sprite.
100
+ image (pygame.Surface): The current frame of the animation.
101
+ __worldPos__ (bool): Whether the sprite is in world space.
102
+
103
+ Methods:
104
+ update (None): Updates the sprite.
105
+ __remove__ (None): Removes the sprite from the game.
106
+ switch_dirrection (None): Switches the direction of the sprite.
107
+ move_by (x, y): Moves the sprite by (x, y) in world space.
108
+ move_to (x, y): Moves the sprite to (x, y) in world space.
109
+ get_pos (None): Returns the position of the sprite in world space.
110
+ rescale (scale): Rescales the sprite by the given scale.
111
+ """
112
+
113
+ def __init__(self, pos, image, imageDim, tileDim, frames, speed, scale = 1.0, collision = True, dirrection = 1):
114
+ """
115
+
116
+ """
117
+
118
+ self.animation = Animation(image, tileDim, (0, 0), frames, speed)
119
+ self.collision = collision
120
+ self.dir = dirrection
121
+ self.pos = pos
122
+
123
+ self.scale = scale
124
+ self.image = pygame.transform.scale_by(self.animation.getFrame(), scale)
125
+ if self.dir == -1:
126
+ self.image = pygame.transform.flip(self.image, True, False)
127
+
128
+ self.__worldPos__ = True
129
+
130
+ #add to game
131
+ Global.game.objs.append(self)
132
+
133
+ def update(self):
134
+ self.animation.update(Global.dt)
135
+ self.image = pygame.transform.scale_by(self.animation.getFrame(), self.scale)
136
+ if self.dir == -1:
137
+ self.image = pygame.transform.flip(self.image, True, False)
138
+
139
+ #world space
140
+ x, y = self.pos
141
+ if self.__worldPos__:
142
+ x = x - Global.cam.x
143
+ y = y - Global.cam.y
144
+ Global.screen.blit(self.image, (x, y))
145
+ if self.collision:
146
+ rect = self.image.get_rect()
147
+ rect.x = x
148
+ rect.y = y
149
+ Global.collisions.append(rect)
150
+
151
+ def __remove__(self):
152
+ Global.game.objs.remove(self)
153
+
154
+ def switch_dirrection(self):
155
+ self.image = pygame.transform.flip(self.image, True, False)
156
+
157
+ def move_by(self, x: int, y: int):
158
+ self.pos = (self.pos[0] + x, self.pos[1] + y)
159
+
160
+ def move_to(self, x: int, y: int):
161
+ self.pos = (x, y)
162
+
163
+ def get_pos(self):
164
+ return self.pos
165
+
166
+ def rescale(self, scale: float):
167
+ self.image = pygame.transform.scale_by(self.image, scale)
168
+
169
+ class AnimationPlayer2D:
170
+ """
171
+ Class for playing animations in a 2D game.
172
+
173
+ Attributes:
174
+ pos (tuple): Position of the AnimationPlayer2D.
175
+ scale (float): Scale of the AnimationPlayer2D.
176
+ anims (dict): Dictionary of animations that can be played, where the key is the name of the animation and the value is an instance of Animated_Sprite2D.
177
+ currentAnim (str): The name of the currently playing animation.
178
+
179
+ Methods:
180
+ update (None): Updates the currently playing animation.
181
+ add_animation (name, image, imageDim, tileDim, frames, speed, scale = 1.0, collision = True, dirrection = 1): Adds an animation to the AnimationPlayer2D.
182
+ remove_animation (name: str): Removes an animation from the AnimationPlayer2D.
183
+ set_worldPos (worldPos: bool): Sets the world position of all animations in the AnimationPlayer2D.
184
+ __remove__ (None): Removes the AnimationPlayer2D from the game.
185
+ set_scale (scale: float): Sets the scale of all animations in the AnimationPlayer2D.
186
+ set_animation (anim: str): Sets the currently playing animation.
187
+ move_by (x, y): Moves the AnimationPlayer2D by (x, y) in world space.
188
+ move_to (x, y): Moves the AnimationPlayer2D to (x, y) in world space.
189
+ get_pos (None): Returns the position of the AnimationPlayer2D in world space.
190
+ """
191
+ def __init__(self, pos, scale):
192
+ self.pos = pos
193
+ self.scale = scale
194
+ self.anims = {}
195
+ self.currentAnim = None
196
+
197
+ self.__worldPos__ = True
198
+
199
+ #add to game
200
+ Global.game.objs.append(self)
201
+
202
+ def update(self):
203
+ if self.currentAnim is not None:
204
+ self.anims[self.currentAnim].update()
205
+
206
+ def add_animation(self, name, image, imageDim, tileDim, frames, speed, scale = 1.0, collision = True, dirrection = 1):
207
+ self.anims[name] = Animated_Sprite2D(self.pos, image, imageDim, tileDim, frames, speed, scale, collision, dirrection)
208
+ self.currentAnim = name
209
+ self.anims[self.currentAnim].__remove__()
210
+
211
+ def remove_animation(self, name: str):
212
+ self.anims[name].__remove__()
213
+ del self.anims[name]
214
+
215
+ def set_worldPos(self, worldPos: bool):
216
+ for anim in self.anims:
217
+ self.anims[anim].__worldPos__ = worldPos
218
+
219
+ def __remove__(self):
220
+ if self in Global.game.objs:
221
+ Global.game.objs.remove(self)
222
+
223
+ def set_scale(self, scale: float):
224
+ for anim in self.anims:
225
+ self.anims[anim].rescale(scale)
226
+
227
+ def set_animation(self, anim: str):
228
+ self.currentAnim = anim
229
+
230
+ def move_by(self, x: int, y: int):
231
+ self.pos = (self.pos[0] + x, self.pos[1] + y)
232
+ for anim in self.anims:
233
+ self.anims[anim].move_by(x, y)
234
+
235
+ def move_to(self, x: int, y: int):
236
+ self.pos = (x, y)
237
+ for anim in self.anims:
238
+ self.anims[anim].move_to(x, y)
239
+
240
+ def get_pos(self):
241
+ return self.pos
242
+
243
+
GameBox/__init__.py CHANGED
@@ -5,7 +5,7 @@ GameBox makes it easy to build 2D games with graphics, sound, and UI in just a f
5
5
  """
6
6
 
7
7
 
8
- __version__ = "0.1.3"
8
+ __version__ = "0.3.0"
9
9
  __author__ = "Sam Fertig"
10
10
 
11
11
  #____imports____
@@ -16,6 +16,10 @@ from .player._player import Player
16
16
  from .basics.utils import clamp, moveTward, zeroOut
17
17
  from .tilemap._tilemap import TileMap
18
18
  from.helpers._input import Keys
19
+ from .ui._basicUI import Image
20
+
21
+ from .GameLevel_ui._sprites import Sprite_2d, Animated_Sprite2D, AnimationPlayer2D, split_image
22
+ from.helpers._Conditions import Conditions
19
23
 
20
24
 
21
25
  __all__ = [
@@ -28,5 +32,11 @@ __all__ = [
28
32
  "zeroOut",
29
33
  "TileMap",
30
34
  "Keys",
35
+ "Image",
36
+ "Sprite_2d",
37
+ "Animated_Sprite2D",
38
+ "AnimationPlayer2D",
39
+ "split_image",
40
+ "Conditions",
31
41
  ]
32
42
 
GameBox/_game.py CHANGED
@@ -26,6 +26,7 @@ class Game:
26
26
  Global.clock = pygame.time.Clock()
27
27
  Global.game = self
28
28
  self.objs = []
29
+ self.ui_objs = []
29
30
 
30
31
 
31
32
  def update(self, event: pygame.event,frame_rate=60):
@@ -40,6 +41,11 @@ class Game:
40
41
  if type(obj) == Player: player = obj
41
42
  else: obj.update()
42
43
  if player != None: player.update()
44
+
45
+ #update ui
46
+ for obj in self.ui_objs:
47
+ obj.update()
48
+
43
49
  pygame.display.update()
44
50
 
45
51
  def get_screen(self):
GameBox/basics/_net.py CHANGED
@@ -18,6 +18,8 @@ class _global_:
18
18
  #-collisions
19
19
  self.collisions: list[pygame.Rect] = []
20
20
 
21
+ self.cond: object = None
22
+
21
23
  #objects
22
24
  self.player = self._player()
23
25
  self.tilemap = []
GameBox/basics/_shapes.py CHANGED
@@ -4,7 +4,26 @@ import numpy as np
4
4
  from ..basics._net import Global
5
5
 
6
6
  class Rect:
7
+ """
8
+ A rectangle shape used for rendering and collision detection.
9
+
10
+ Args:
11
+ pos (tuple): The position of the rectangle.
12
+ size (tuple): The size of the rectangle.
13
+ color (tuple, optional): The color of the rectangle. Defaults to (0,0,0).
14
+ collision (bool, optional): Whether the rectangle should be used for collision detection. Defaults to True.
15
+ """
16
+
7
17
  def __init__(self, pos: tuple, size: tuple, color: tuple = (0, 0, 0), collision: bool = True):
18
+ """
19
+ Initialize the rectangle object.
20
+
21
+ Args:
22
+ pos (tuple): The position of the rectangle.
23
+ size (tuple): The size of the rectangle.
24
+ color (tuple, optional): The color of the rectangle. Defaults to (0,0,0).
25
+ collision (bool, optional): Whether the rectangle should be used for collision detection. Defaults to True.
26
+ """
8
27
  self.x, self.y = pos
9
28
  self.width, self.height = size
10
29
  self.color = color
@@ -12,6 +31,12 @@ class Rect:
12
31
  self.collision = collision
13
32
 
14
33
  def update(self):
34
+ """
35
+ Update the rectangle object.
36
+
37
+ This method updates the position and size of the rectangle based on the camera's position and scale.
38
+ It then renders the rectangle to the screen and adds it to the collision detection list if necessary.
39
+ """
15
40
  width = self.width * Global.cam.scale
16
41
  height = self.height * Global.cam.scale
17
42
  if (Global.cam.follow) != (self):
@@ -21,13 +46,43 @@ class Rect:
21
46
  x = self.x
22
47
  y = self.y
23
48
 
24
- rect = pygame.Rect(x, y, width ,height)
49
+ rect = pygame.Rect(x, y, width, height)
25
50
  if self.collision: Global.collisions.append(rect)
26
51
  pygame.draw.rect(Global.screen, self.color, rect)
27
52
 
28
53
  def move(self, x, y):
54
+ """
55
+ Move the rectangle object.
56
+
57
+ Args:
58
+ x (int): The x-coordinate to move the rectangle by.
59
+ y (int): The y-coordinate to move the rectangle by.
60
+ """
29
61
  if (Global.cam.follow) != (self):
30
62
  self.x += x
31
63
  self.y += y
32
64
  else:
33
- Global.cam.move(x, y)
65
+ Global.cam._move(x, y)
66
+
67
+ def move_to(self, x, y):
68
+ """
69
+ Move the rectangle object to a specific position.
70
+
71
+ Args:
72
+ x (int): The x-coordinate to move the rectangle to.
73
+ y (int): The y-coordinate to move the rectangle to.
74
+ """
75
+ if (Global.cam.follow) != (self):
76
+ self.x = x
77
+ self.y = y
78
+ else:
79
+ Global.cam.x = x
80
+ Global.cam.y = y
81
+
82
+ def __remove__(self):
83
+ """
84
+ Remove the rectangle object from the game.
85
+
86
+ This method removes the rectangle object from the game's object list.
87
+ """
88
+ Global.game.objs.remove(self)
GameBox/basics/cammera.py CHANGED
@@ -6,7 +6,17 @@ from ._net import Global
6
6
  from ..basics.utils import moveTward
7
7
 
8
8
  class Cammera:
9
+ """
10
+ A class for the camera object.
11
+ """
12
+
9
13
  def __init__(self, scale: float = 1.0):
14
+ """
15
+ Initialize the camera object.
16
+
17
+ Args:
18
+ scale (float): The scale of the camera (default: 1.0)
19
+ """
10
20
  self.x = 0
11
21
  self.y = 0
12
22
  Global.game.objs.append(self)
@@ -15,22 +25,51 @@ class Cammera:
15
25
  self.diff = (0, 0)
16
26
  self.scale = scale
17
27
 
18
- def move(self, x, y):
28
+ def _move(self, x: int, y: int):
29
+ """
30
+ Move the camera by (x, y).
31
+
32
+ Args:
33
+ x (int): The x component of the movement
34
+ y (int): The y component of the movement
35
+ """
19
36
  self.x += x
20
37
  self.y += y
21
38
 
22
39
  def update(self):
40
+ """
41
+ Update the camera position based on the follow target.
42
+ """
23
43
  return
24
44
  if self.follow is not None:
25
45
  self.x = (self.follow.x - self.diff[0])
26
46
  self.y = (self.follow.y - self.diff[1])
27
47
 
28
48
  def set_follow_target(self, target: object):
49
+ """
50
+ Set the follow target for the camera.
51
+
52
+ Args:
53
+ target (object): The object to follow
54
+ """
29
55
  self.follow = target
30
56
  print(target)
31
57
  self.diff = (target.x - self.x, target.y - self.y)
32
58
 
33
59
  def set_scale(self, scale: float = 1.0):
60
+ """
61
+ Set the scale of the camera.
62
+
63
+ Args:
64
+ scale (float): The scale of the camera (default: 1.0)
65
+ """
34
66
  self.scale = scale
67
+
35
68
  def change_scale(self, scale: float = 1.0):
69
+ """
70
+ Change the scale of the camera by the given amount.
71
+
72
+ Args:
73
+ scale (float): The amount to change the scale by (default: 1.0)
74
+ """
36
75
  self.scale += scale
@@ -0,0 +1,65 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ..basics.utils import zeroOut
5
+ from ..basics._net import Global
6
+
7
+ class _Conditions:
8
+ """
9
+ Class containing the predefined conditions for the game.
10
+ Conditions are in the format of 'C' followed by the command ('v' for velocity), and dir (^ up, _ down, < left, > right, # none, ~ any)
11
+ """
12
+
13
+ def __init__(self):
14
+ """
15
+ Initialize the conditions.
16
+ """
17
+ # conditions start with 'C' and then command ('v' for velocity), and dir (^ up, _ down, < left, > right, # none, ~ any)
18
+ self.velocity_up = 'CV^' # velocity up
19
+ self.velocity_down = 'CV_' # velocity down
20
+ self.velocity_left = 'CV<' # velocity left
21
+ self.velocity_right = 'CV>' # velocity right
22
+ self.velocity_none = 'CV#' # velocity none
23
+ self.velocity_any = 'CV~' # velocity any
24
+
25
+ Conditions = _Conditions()
26
+ Global.cond = Conditions
27
+
28
+ class Condition_check:
29
+ def __init__(self, stateTree: dict[str, dict[_Conditions, str]], currentState: str):
30
+ self.stateTree = stateTree
31
+ self.currentState = currentState
32
+
33
+ def check(self, velocity: tuple, pos: tuple):
34
+ state = self.stateTree[self.currentState]
35
+ for cond, next in state.items():
36
+ #velocities
37
+ if cond[1] == 'V':
38
+ if self._resolve_velocities(velocity, cond):
39
+ self.currentState = next
40
+ return next
41
+ return self.currentState
42
+
43
+
44
+ def _resolve_velocities(self, velocities, cond):
45
+ vx, vy = velocities
46
+ Max = 0.3
47
+ vx = zeroOut(vx, Max)
48
+ vy = zeroOut(vy, Max)
49
+ dir = cond[2]
50
+ print(vx, vy, dir)
51
+ #resolve in order up, down, left, right, none, any
52
+ if dir == "^" and vy < 0: return True
53
+ if dir == "_" and vy > 0: return True
54
+ if dir == "<" and vx < 0: return True
55
+ if dir == ">" and vx > 0: return True
56
+ if dir == "#" and vx == 0 and vy == 0: return True
57
+ if dir == "~" and (vx != 0 or vy != 0): return True
58
+ return False
59
+
60
+ def updateState(self, state: str):
61
+ self.currentState = state
62
+ def updateStateTree(self, stateTree: dict[str, dict[_Conditions, str]]):
63
+ self.stateTree = stateTree
64
+
65
+
@@ -7,7 +7,6 @@ from ..basics._net import Global
7
7
  def CheckCollisions(x, y, vx, vy, dim, sample, obj):
8
8
  x, y = x + vx, y + vy
9
9
 
10
-
11
10
  #basic object collisions
12
11
  x, y, vx, vy = _mainCollisionLogic(Global.collisions, x, y, vx, vy, dim)
13
12
  x, y, vx, vy = _checkTilemapCollisions(x, y, vx, vy, dim, sample, obj)
@@ -15,20 +14,12 @@ def CheckCollisions(x, y, vx, vy, dim, sample, obj):
15
14
  return x, y, vx, vy
16
15
 
17
16
  def _mainCollisionLogic(collisions, x, y, vx, vy, dim):
18
- new_rect = pygame.Rect((x, y), dim)
19
- for collision in collisions:
20
- #pygame.draw.rect(Global.screen, (255, 0, 0), collision, 1)
21
- if collision.colliderect(new_rect):
22
- if vx > 0:
23
- x = collision.left - dim[0]
24
- elif vx < 0:
25
- x = collision.right
26
- vx = 0
27
-
28
17
  # Y-axis collisions
18
+ py = y
29
19
  new_rect = pygame.Rect((x, y), dim)
20
+ pygame.draw.rect(Global.screen, "green", new_rect, 5)
30
21
  for collision in collisions:
31
- #pygame.draw.rect(Global.screen, (255, 0, 0), collision, 1)
22
+ pygame.draw.rect(Global.screen, "yellow", collision, 5)
32
23
  if collision.colliderect(new_rect):
33
24
  if vy > 0: # falling
34
25
  y = collision.top - dim[1]
@@ -36,6 +27,16 @@ def _mainCollisionLogic(collisions, x, y, vx, vy, dim):
36
27
  elif vy < 0: # jumping
37
28
  y = collision.bottom
38
29
  vy = 0
30
+
31
+ new_rect = pygame.Rect((x, py), dim)
32
+ for collision in collisions:
33
+ pygame.draw.rect(Global.screen, "yellow", collision, 5)
34
+ if collision.colliderect(new_rect):
35
+ if vx > 0:
36
+ x = collision.left - dim[0]
37
+ elif vx < 0:
38
+ x = collision.right
39
+ vx = 0
39
40
 
40
41
  return x, y, vx, vy
41
42
 
GameBox/helpers/_input.py CHANGED
@@ -4,6 +4,9 @@ from ..basics._net import Global
4
4
 
5
5
 
6
6
  class _keys:
7
+ """
8
+ A class that holds all the key bindings for the game
9
+ """
7
10
  def __init__(self):
8
11
 
9
12
  #alphabet
@@ -61,6 +64,7 @@ class _keys:
61
64
 
62
65
  #mouse
63
66
  self.mouse_x, self.mouse_y = 0, 0
67
+
64
68
  def init(self): Global.game.objs.append(self)
65
69
 
66
70
  def is_pressed(self, key):
GameBox/player/_player.py CHANGED
@@ -4,37 +4,61 @@ import numpy as np
4
4
  from ..basics._net import Global
5
5
 
6
6
  from ..player._playerPhysics import _playerPhysics
7
+ from ..player._playerSprite import _playerSprite
8
+
9
+ from ..GameLevel_ui._sprites import Sprite_2d
7
10
 
8
11
  class Player:
12
+ """
13
+ Initialize a Player object.
14
+
15
+ Parameters:
16
+ pos (tuple): The position of the Player in world space.
17
+ size (tuple): The size of the Player in world space.
18
+ color (tuple): The color of the Player (default: (0, 0, 0)).
19
+ gravity (bool): Whether the Player is affected by gravity (default: False).
20
+
21
+ Returns:
22
+ None
23
+ """
9
24
  def __init__(self, pos: tuple, size: tuple, color: tuple = (0, 0, 0), gravity: bool = False):
25
+ # Set the position and size of the Player
10
26
  self.x, self.y = pos
11
27
  self.screenPos = pos
12
28
  self.dim = size
13
29
  self.color = color
30
+ self.width, self.height = size
14
31
 
32
+ # Set whether the Player is affected by gravity
15
33
  self.gravity = gravity
16
-
34
+
35
+ # State of the Player (e.g. "jumping", "standing", etc.)
36
+ self.state = ""
37
+
38
+ # Add the Player to the game
17
39
  Global.game.objs.append(self)
18
40
  Global.player.pos = pos
19
41
  Global.player.player = self
20
42
 
43
+ # Initialize the sprite for the Player
44
+ self.sprite = _playerSprite(self)
45
+
21
46
 
22
47
  def add_physics(self, speed: float = 1.0, gravity: float = 0.0, jump: float = 10.0, maxV: float = 10.0, airRes: float = 0.2):
23
48
  self.physics = _playerPhysics(self, speed, gravity, jump, maxV, airRes)
24
49
 
25
50
  def update(self):
26
51
  self.physics.update()
27
- #debug rect
28
- width = self.dim[0] * Global.cam.scale
29
- height = self.dim[1] * Global.cam.scale
52
+ #ui
53
+
30
54
  if (Global.cam.follow) != (self):
31
55
  x = self.x - Global.cam.x
32
56
  y = self.y - Global.cam.y
33
57
  elif (Global.cam.follow) == (self):
34
58
  x = self.x
35
59
  y = self.y
36
- rect = pygame.Rect(x, y, width, height)
37
- pygame.draw.rect(Global.screen, self.color, rect)
60
+ velocity = (self.physics.vx, self.physics.vy)
61
+ self.sprite.update(x, y, velocity)
38
62
 
39
63
  #movement
40
64
  def top_down_movement(self):
@@ -50,3 +74,5 @@ class Player:
50
74
  The larger the sample size the longer it may take to calculate collisions per frame.
51
75
  """
52
76
  self.physics.sample = sample
77
+
78
+
@@ -19,7 +19,7 @@ class _playerPhysics:
19
19
  self.onGround = False
20
20
  self.canJump = False
21
21
 
22
- self.sample = 10
22
+ self.sample = 25
23
23
 
24
24
  self.vx, self.vy = 0, 0
25
25
 
@@ -34,7 +34,7 @@ class _playerPhysics:
34
34
  elif (Global.cam.follow) == (self.player):
35
35
  dx = -(self.player.x - x)
36
36
  dy = -(self.player.y - y)
37
- Global.cam.move(self.vx, self.vy)
37
+ Global.cam._move(self.vx, self.vy)
38
38
 
39
39
 
40
40
 
@@ -0,0 +1,86 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ..basics._net import Global
5
+
6
+ from ..GameLevel_ui._sprites import Sprite_2d, Animated_Sprite2D, AnimationPlayer2D
7
+ from ..helpers._Conditions import Condition_check, _Conditions
8
+
9
+ class _playerSprite:
10
+ def __init__(self, player):
11
+ self.player = player
12
+
13
+ self.state = player.state
14
+ self.statetree = {}
15
+ self.condition_check = None
16
+
17
+ self.sprite = None
18
+
19
+
20
+ def update(self, x, y, velocity):
21
+ #state updates
22
+ if self.condition_check is not None:
23
+ self.state = self.condition_check.check(velocity, self.player.screenPos)
24
+ #set animation if possible
25
+ if type(self.sprite) == AnimationPlayer2D:
26
+ if self.state in self.sprite.anims:
27
+ self.sprite.set_animation(self.state)
28
+ #any changes to follow target
29
+ if Global.cam.follow == self.player and self.sprite is not None:
30
+ self.sprite.__worldPos__ = False
31
+ self.sprite.move_to(self.player.screenPos[0], self.player.screenPos[1])
32
+ elif Global.cam.follow != self.player and self.sprite is not None:
33
+ self.sprite.__worldPos__ = True
34
+ self.sprite.move_to(self.player.x, self.player.y)
35
+
36
+ if self.sprite is None:
37
+ #rect (x, y) is top left corner
38
+ rect = pygame.Rect((x, y), self.player.dim)
39
+ pygame.draw.rect(Global.screen, self.player.color, rect)
40
+ if type(self.sprite) == Sprite_2d:
41
+ self.sprite.update()
42
+ elif type(self.sprite) == Animated_Sprite2D:
43
+ self.sprite.update()
44
+ elif type(self.sprite) == AnimationPlayer2D:
45
+ self.sprite.update()
46
+
47
+ def add_sprite_2d(self, image, scale=1.0, dirrection=1):
48
+ self.sprite = Sprite_2d((self.player.x, self.player.y), image, scale, False, dirrection)
49
+ if Global.cam.follow == self.player:
50
+ self.sprite.__worldPos__ = False
51
+ self.sprite.__remove__()
52
+
53
+ def add_animated_sprite_2d(self, image, imageDim, tileDim, frames, speed, scale = 1.0, collision = False, dirrection = 1):
54
+ self.sprite = Animated_Sprite2D((self.player.x, self.player.y), image, imageDim, tileDim, frames, speed, scale, collision, dirrection)
55
+ if Global.cam.follow == self.player:
56
+ self.sprite.__worldPos__ = False
57
+ self.sprite.__remove__()
58
+
59
+ def remove_sprite(self):
60
+ if self.sprite is not None:
61
+ self.sprite = None
62
+
63
+ def add_animation_player(self, scale = 1.0):
64
+ self.sprite = AnimationPlayer2D((self.player.x, self.player.y), scale)
65
+ if Global.cam.follow == self.player:
66
+ self.sprite.set_worldPos(False)
67
+ self.sprite.__remove__()
68
+
69
+ def add_animation(self, name, image, imageDim, tileDim, frames, speed, scale = 1.0, collision = True, dirrection = 1):
70
+ self.sprite.add_animation(name, image, imageDim, tileDim, frames, speed, scale, collision, dirrection)
71
+ self.sprite.__remove__()
72
+ self.sprite.set_worldPos(False)
73
+
74
+ def remove_animation(self, name: str):
75
+ self.sprite.remove_animation(name)
76
+
77
+ def set_animation(self, anim: str):
78
+ self.sprite.set_animation(anim)
79
+
80
+ def set_states(self, stateTree: dict[str, dict[_Conditions, str]], currentState: str):
81
+ self.statetree = stateTree
82
+ self.state = currentState
83
+ self.condition_check = Condition_check(self.statetree, self.state)
84
+
85
+
86
+
@@ -3,6 +3,9 @@ import numpy as np
3
3
 
4
4
  from..helpers._input import Keys
5
5
  from ..basics._net import Global
6
+ from ._collisionDef import _tileCollisionDefs
7
+
8
+ from._editorBrushes import _brushPencil, _collisionsPencil
6
9
 
7
10
  class _tilemapEditor:
8
11
  def __init__(self, tilemap, activation):
@@ -10,92 +13,24 @@ class _tilemapEditor:
10
13
  self.activation = activation
11
14
  self.active = False
12
15
 
13
- self.selectedTile = 1
14
- self.mx, self.my = Keys.mouse_x, Keys.mouse_y
16
+ self.mode = _brushPencil()
15
17
 
16
- self.mode = "paint"
18
+ self.changes = {
19
+ "pencil": Keys.b,
20
+ "collisions": Keys.c
21
+
22
+ }
17
23
 
18
24
  def _update(self):
19
25
  if self.active:
20
- #update mouse pos
21
- self.mx, self.my = Keys.mouse_x, Keys.mouse_y
22
- self.mx += Global.cam.x
23
- self.my += Global.cam.y
24
- self.mx = self.mx // self.tilemap.tileDim[0] * self.tilemap.tileDim[0]
25
- self.my = self.my // self.tilemap.tileDim[1] * self.tilemap.tileDim[1]
26
-
27
- self._mode_()
28
- self.moveSelectionByArrowKeys()
29
- self.ui()
30
-
26
+ self.change_mode()
27
+ #editor stuff
28
+ self.mode.update(self.tilemap)
31
29
  #toggle
32
30
  if Keys.is_pressed(self.activation): self.active = not self.active
33
31
 
34
- def _mode_(self):
35
- x, y = Keys.mouse_x, Keys.mouse_y
36
- if x > self.tilemap.tileset.get_size()[0] * self.tilemap.tilescale / 2 or y > self.tilemap.tileset.get_size()[1] * self.tilemap.tilescale / 2:
37
- self.mode = "paint"
38
- #more parrimeters will be placed as needed
39
- else:
40
- self.mode = "select"
41
-
42
- def ui(self):
43
- tile = self.tilemap.tiles[self.selectedTile]
44
- image = pygame.transform.scale_by(self.tilemap.tileset, self.tilemap.tilescale / 2)
45
- Global.screen.blit(image, (0, 0))
46
- #show outlined sellected tile
47
- x, y = self.tilemap.tilePosInImage[self.selectedTile]
48
- x *= self.tilemap.tilescale / 2
49
- y *= self.tilemap.tilescale / 2
50
- width = self.tilemap.orginDim[0] * self.tilemap.tilescale / 2
51
- height = self.tilemap.orginDim[1] * self.tilemap.tilescale / 2
52
- outline = pygame.Rect(x, y, width, height)
53
- pygame.draw.rect(Global.screen, "white", outline, 2)
54
- #other stuff
55
- if self.mode == "paint":
56
- #show selected tile
57
- #--outline on tileset
58
- #--show beside mouse
59
- x = self.mx
60
- y = self.my
61
-
62
- x -= Global.cam.x
63
- y -= Global.cam.y
64
- Global.screen.blit(tile, (x, y))
65
- if pygame.mouse.get_pressed()[0]:
66
- #check if mouse is on tilemap
67
- x, y = self.mx // self.tilemap.tileDim[0], self.my // self.tilemap.tileDim[1]
68
- if x >= 0 and x < self.tilemap.mapDim[0] and y >= 0 and y < self.tilemap.mapDim[1]:
69
- self.tilemap.map[int(y)][int(x)] = self.selectedTile
70
- if pygame.mouse.get_pressed()[2]:
71
- x, y = self.mx // self.tilemap.tileDim[0], self.my // self.tilemap.tileDim[1]
72
- if x >= 0 and x < self.tilemap.mapDim[0] and y >= 0 and y < self.tilemap.mapDim[1]:
73
- self.tilemap.map[int(y)][int(x)] = 0
74
- elif self.mode == "select":
75
- #paint mouse hovered tile
76
- x, y = Keys.mouse_x, Keys.mouse_y
77
- x = (x // width)
78
- y = (y // height)
79
- outline = pygame.Rect(x * width, y * width, width, height)
80
- pygame.draw.rect(Global.screen, "black", outline, 2)
81
- if pygame.mouse.get_pressed()[0]:
82
- x *= self.tilemap.orginDim[0]
83
- y *= self.tilemap.orginDim[1]
84
- self.selectedTile = self.tilemap.posToTile[(int(x), int(y))]
85
-
86
-
87
- def moveSelectionByArrowKeys(self):
88
- x, y = self.tilemap.tilePosInImage[self.selectedTile]
89
-
90
- width = 16
91
- height = 16
92
-
93
- if Keys.is_pressed(Keys.left): x -= width
94
- if Keys.is_pressed(Keys.right): x += width
95
- if Keys.is_pressed(Keys.up): y -= height
96
- if Keys.is_pressed(Keys.down): y += height
97
-
98
- if (int(x), int(y)) in self.tilemap.posToTile:
99
- self.selectedTile = self.tilemap.posToTile[(int(x), int(y))]
100
-
101
-
32
+ def change_mode(self):
33
+ #key presses
34
+ if Keys.is_pressed(self.changes["pencil"]): self.mode = _brushPencil()
35
+ elif Keys.is_pressed(self.changes["collisions"]): self.mode = _collisionsPencil(self.tilemap)
36
+
@@ -3,6 +3,13 @@ import pygame
3
3
  class _tileCollisionDefs:
4
4
  def __init__(self, tileDim):
5
5
  width, height = tileDim
6
+
7
+
8
+ self.rects = ["full", "none", "halfLeft", "halfRight", "halfTop", "halfBottom", "topRight",
9
+ "topLeft", "bottomRight", "bottomLeft", "dot"]
10
+
11
+ self.num = len(self.rects) + 1
12
+
6
13
  self.full = pygame.Rect(0, 0, width, height)
7
14
 
8
15
  self.halfLeft = pygame.Rect(0, 0, width / 2, height)
@@ -0,0 +1,166 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ..basics._net import Global
5
+ from ..helpers._input import Keys
6
+ from ._collisionDef import _tileCollisionDefs
7
+
8
+ class _brushPencil():
9
+ def __init__(self):
10
+ self.selectedTile = 1
11
+ self.mode = "paint"
12
+
13
+ def update(self, tilemap):
14
+ #get all mouse calculations
15
+ x, y = Keys.mouse_x, Keys.mouse_y
16
+ x += Global.cam.x
17
+ y += Global.cam.y
18
+ mx = x // tilemap.tileDim[0] * tilemap.tileDim[0]
19
+ my = y // tilemap.tileDim[1] * tilemap.tileDim[1]
20
+
21
+ #get mode
22
+ x, y = Keys.mouse_x, Keys.mouse_y
23
+ if x > tilemap.tileset.get_size()[0] * tilemap.tilescale / 2 or y > tilemap.tileset.get_size()[1] * tilemap.tilescale / 2:
24
+ self.mode = "paint"
25
+ else:
26
+ self.mode = "select"
27
+
28
+ #--show tileset
29
+ tile = tilemap.tiles[self.selectedTile]
30
+ image = pygame.transform.scale_by(tilemap.tileset, tilemap.tilescale / 2)
31
+ Global.screen.blit(image, (0, 0))
32
+ #--show outlined sellected tile
33
+ x, y = tilemap.tilePosInImage[self.selectedTile]
34
+ x *= tilemap.tilescale / 2
35
+ y *= tilemap.tilescale / 2
36
+ width = tilemap.orginDim[0] * tilemap.tilescale / 2
37
+ height = tilemap.orginDim[1] * tilemap.tilescale / 2
38
+ outline = pygame.Rect(x, y, width, height)
39
+ pygame.draw.rect(Global.screen, "white", outline, 2)
40
+ #other stuff
41
+ if self.mode == "paint":
42
+ x = mx
43
+ y = my
44
+
45
+ x -= Global.cam.x
46
+ y -= Global.cam.y
47
+ Global.screen.blit(tile, (x, y))
48
+ #set tile or erase
49
+ if pygame.mouse.get_pressed()[0]:
50
+ #check if mouse is on tilemap
51
+ x, y = mx // tilemap.tileDim[0], my // tilemap.tileDim[1]
52
+ if x >= 0 and x < tilemap.mapDim[0] and y >= 0 and y < tilemap.mapDim[1]:
53
+ tilemap.map[int(y)][int(x)] = self.selectedTile
54
+ elif pygame.mouse.get_pressed()[2]:
55
+ x, y = mx // tilemap.tileDim[0], my // tilemap.tileDim[1]
56
+ if x >= 0 and x < tilemap.mapDim[0] and y >= 0 and y < tilemap.mapDim[1]:
57
+ tilemap.map[int(y)][int(x)] = 0
58
+ elif self.mode == "select":
59
+ #paint mouse hovered tile
60
+ x, y = Keys.mouse_x, Keys.mouse_y
61
+ x = (x // width)
62
+ y = (y // height)
63
+ outline = pygame.Rect(x * width, y * width, width, height)
64
+ pygame.draw.rect(Global.screen, "black", outline, 2)
65
+ if pygame.mouse.get_pressed()[0]:
66
+ x *= tilemap.orginDim[0]
67
+ y *= tilemap.orginDim[1]
68
+ self.selectedTile = tilemap.posToTile[(int(x), int(y))]
69
+
70
+ #move selection by arrow keys
71
+ x, y = tilemap.tilePosInImage[self.selectedTile]
72
+
73
+ width = 16
74
+ height = 16
75
+
76
+ if Keys.is_pressed(Keys.left): x -= width
77
+ if Keys.is_pressed(Keys.right): x += width
78
+ if Keys.is_pressed(Keys.up): y -= height
79
+ if Keys.is_pressed(Keys.down): y += height
80
+
81
+ if (int(x), int(y)) in tilemap.posToTile:
82
+ self.selectedTile = tilemap.posToTile[(int(x), int(y))]
83
+
84
+ class _collisionsPencil():
85
+ def __init__(self, tilemap):
86
+ self.selectedTile = 0
87
+ self.shapes = tilemap.collisionShapes.num
88
+ self.mode = "paint"
89
+ size = tilemap.tilescale / 2
90
+ self.size = tilemap.orginDim[0] * size
91
+ self.coll = _tileCollisionDefs((tilemap.orginDim[0] * size, tilemap.orginDim[1] * size))
92
+
93
+ def update(self, tilemap):
94
+ x, y = Keys.mouse_x, Keys.mouse_y
95
+ #draw tilesets and background
96
+ Global.screen.fill("darkgrey")
97
+ image = pygame.transform.scale_by(tilemap.tileset, tilemap.tilescale / 2)
98
+ Global.screen.blit(image, (0, 0))
99
+ Global.screen.blit(image, (0, image.get_size()[1]+ 10))
100
+ #draw all collision rects on top tileset
101
+ for tile in range(tilemap.tilesetNum - 1):
102
+ tile+=1
103
+ if str(tile) not in tilemap.collisionDict: continue
104
+ rectshape = tilemap.collisionDict[str(tile)]
105
+ rect = getattr(self.coll, rectshape).copy()
106
+ tx, ty = tilemap.tilePosInImage[int(tile)]
107
+ tx = (tx // tilemap.orginDim[0]) * self.size
108
+ ty = (ty // tilemap.orginDim[1]) * self.size
109
+ rect.x += tx
110
+ rect.y += ty
111
+ pygame.draw.rect(Global.screen, "yellow", rect, 5)
112
+ outline = pygame.Rect(tx, ty, self.size, self.size)
113
+ pygame.draw.rect(Global.screen, "gray", outline, 2)
114
+ #change mode
115
+ if y > image.get_size()[1] * 2 + 50: self.mode = "select"
116
+ else: self.mode = "paint"
117
+ #draw collisions tiles at bottom
118
+ tx, ty = 0, image.get_size()[1] * 2 + 50
119
+ for tile in range(self.shapes-1):
120
+ rect = getattr(self.coll, tilemap.collisionShapes.rects[tile]).copy()
121
+ rect.x += tx
122
+ rect.y += ty
123
+ pygame.draw.rect(Global.screen, "yellow", rect, 5)
124
+ outline = pygame.Rect(tx, ty, self.size, self.size)
125
+ pygame.draw.rect(Global.screen, "gray", outline, 2)
126
+ tx += self.size + self.size / 2
127
+ #paint mode
128
+ if self.mode == "paint":
129
+ #draw tile around mouse
130
+ rect = getattr(self.coll, tilemap.collisionShapes.rects[self.selectedTile]).copy()
131
+ rect.x += x - self.size / 2
132
+ rect.y += y - self.size / 2
133
+ pygame.draw.rect(Global.screen, "yellow", rect, 5)
134
+ outline = pygame.Rect(x, y, self.size, self.size)
135
+ outline.center = (Keys.mouse_x, Keys.mouse_y)
136
+ pygame.draw.rect(Global.screen, "gray", outline, 2)
137
+ #paint collisions
138
+ size = tilemap.orginDim[0]
139
+ if pygame.mouse.get_pressed()[0]:
140
+ x = (x - (x % self.size)) // self.size
141
+ y = (y - (y % self.size)) // self.size
142
+ px = x * size
143
+ py = y * size
144
+ if (int(px), int(py)) in tilemap.posToTile:
145
+ tilemap.collisionDict[str(tilemap.posToTile[(int(px), int(py))])] = self.coll.rects[self.selectedTile]
146
+ #erase collisions
147
+ if pygame.mouse.get_pressed()[2]:
148
+ x = (x - (x % self.size)) // self.size
149
+ y = (y - (y % self.size)) // self.size
150
+ px = x * size
151
+ py = y * size
152
+ if (int(px), int(py)) in tilemap.posToTile:
153
+ tilemap.collisionDict[tilemap.posToTile[(int(px), int(py))]] = "none"
154
+
155
+ elif self.mode == "select":
156
+ #get tile at mouse
157
+ x = int(x // (self.size + self.size / 2))
158
+ #draw underline
159
+ underline = pygame.Rect((0, 0), (self.size, 5))
160
+ underline.center = (Keys.mouse_x, ty + self.size+5)
161
+ pygame.draw.rect(Global.screen, "black", underline)
162
+ #select tile
163
+ if pygame.mouse.get_pressed()[0] and x < self.shapes-1 and x >= 0:
164
+ self.selectedTile = int(x)
165
+
166
+
@@ -9,6 +9,20 @@ from ._Editor import _tilemapEditor
9
9
 
10
10
  class TileMap:
11
11
  def __init__(self, tileSet: str, tileDim: tuple, tileScale: float, mapDim: tuple, mapFill: int, saveFile = None):
12
+ """
13
+ Constructor for TileMap object.
14
+
15
+ Args:
16
+ tileSet (str): filepath to tileset image
17
+ tileDim (tuple): dimensions of a single tile
18
+ tileScale (float): scale of tiles relative to tileset image
19
+ mapDim (tuple): dimensions of the map
20
+ mapFill (int): default tile id to fill map with
21
+ saveFile (str): filepath to save map to (default is None)
22
+
23
+ Returns:
24
+ None
25
+ """
12
26
  self.tilesetFile = tileSet
13
27
  self.mapFile = saveFile
14
28
  self.tileDim = (tileDim[0] * tileScale, tileDim[1] * tileScale)
@@ -17,6 +31,8 @@ class TileMap:
17
31
  self.tilescale = tileScale
18
32
  self.orginDim = tileDim
19
33
 
34
+ self.tilesetNum = 0
35
+
20
36
  self.editor = None
21
37
 
22
38
  Global.game.objs.append(self)
@@ -46,10 +62,10 @@ class TileMap:
46
62
  self.tiles[tile_id] = pygame.transform.scale(tile, self.tileDim)
47
63
  self.tilePosInImage[tile_id] = (x, y)
48
64
  self.posToTile[(x, y)] = tile_id
65
+ self.tilesetNum += 1
49
66
  tile_id += 1
50
67
 
51
68
  Global.tilemap.append(self)
52
- print(self.posToTile)
53
69
 
54
70
  def load_map_from_json(self, filePath: str):
55
71
  with open(filePath, "r") as f:
GameBox/ui/_basicUI.py ADDED
@@ -0,0 +1,65 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from ..basics._net import Global
5
+
6
+ from ..GameLevel_ui._sprites import Sprite_2d
7
+
8
+ class Image:
9
+ def __init__(self, pos: tuple, image, scale: float = 1.0):
10
+ """
11
+ Initialize an Image UI element.
12
+
13
+ Args:
14
+ pos: Tuple (x, y) for the image position
15
+ image: Either a file path (str) or pygame.Surface object
16
+ scale: Scale factor for the image (default: 1.0)
17
+ """
18
+ #add to game
19
+ self.image = Sprite_2d(pos, image, scale)
20
+ self.image.__remove__()
21
+ Global.game.ui_objs.append(self)
22
+
23
+ def move_by(self, x: int, y: int):
24
+ """
25
+ Move the image by (x, y) in world space.
26
+
27
+ Args:
28
+ x: int, the x component of the movement
29
+ y: int, the y component of the movement
30
+ """
31
+ self.image.move_by(x, y)
32
+
33
+ def move_to(self, x: int, y: int):
34
+ """
35
+ Move the image to (x, y) in world space.
36
+
37
+ Args:
38
+ x: int, the x component of the position
39
+ y: int, the y component of the position
40
+ """
41
+ self.image.move_to(x, y)
42
+
43
+ def get_pos(self):
44
+ """
45
+ Get the position of the image in world space.
46
+
47
+ Returns:
48
+ tuple: (x, y) the position of the image
49
+ """
50
+ return self.image.get_pos()
51
+
52
+ def rescale(self, scale: float):
53
+ """
54
+ Rescale the image by the given scale.
55
+
56
+ Args:
57
+ scale: float, the scale factor
58
+ """
59
+ self.image.rescale(scale)
60
+
61
+ def update(self):
62
+ """
63
+ Update the image by drawing it on the screen.
64
+ """
65
+ Global.screen.blit(self.image.image, self.image.pos)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameBox
3
- Version: 0.2.0
3
+ Version: 0.9.0
4
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
5
  Author-email: Sam Fertig <sfertig007@gmail.com>
6
6
  License-Expression: MIT
@@ -0,0 +1,25 @@
1
+ GameBox/__init__.py,sha256=HVJfnUcXHAjp4wIR_uz4u9lwLZpiChdvzf6y0aPvkj8,1025
2
+ GameBox/_game.py,sha256=l55gMoNTbFrMBYJzwK8RX8oP414qBtyDik9bmcuexys,1675
3
+ GameBox/GameLevel_ui/_Animations.py,sha256=nza-F3Rii6VWAvIkSKNr1CpkJXxq4jLqZcYfb0Sk1hI,1051
4
+ GameBox/GameLevel_ui/_sprites.py,sha256=BmfTi4_gnP2rlIOH6luG8cJjXwNRArBmyy_0iYrE7I0,8579
5
+ GameBox/basics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ GameBox/basics/_net.py,sha256=zXuw1YkC3Qobx6sAl2u3fvp_ghJsfHem6L59NTmTfRE,802
7
+ GameBox/basics/_shapes.py,sha256=2bSlNMJlRKHSHljmiD7nn9Kh8VEFPHygxzzONGvvgfs,3008
8
+ GameBox/basics/cammera.py,sha256=MPsl-H2hMOfmPPfPiyfT--wGkUSCR1i3ZMo9Qnb9ChE,1895
9
+ GameBox/basics/utils.py,sha256=w6H34MhxcNoX58iQtlvbT5-4GXefy3RIMTxZGP9fSxA,432
10
+ GameBox/helpers/_Conditions.py,sha256=LY0sVuIR_3ZewDDx-Ud9WoM3HFhLh9rR2RaiRSd1Gr4,2350
11
+ GameBox/helpers/_collisions.py,sha256=VJy26jaJOLjnKFD_i5MBhsKg0OHXpqJVcMU0PcACgrI,4414
12
+ GameBox/helpers/_input.py,sha256=KyhqkLykI6czIhvu3BLISmFkbw_6PRzCuK48LVV4zM8,2041
13
+ GameBox/player/_player.py,sha256=GsWAERz9SWRD3qEyBQDLXo85OLEPTP5m_5sI4CHLRL0,2486
14
+ GameBox/player/_playerControler.py,sha256=XEb87RFlgLFoXnXqxIS4lpzHN0wywMNCX5y-NIhw0cs,1715
15
+ GameBox/player/_playerPhysics.py,sha256=-6u-TZH_i78bwFMZwCIHP0VnQA0nOlcQtkq07rxwKwg,2919
16
+ GameBox/player/_playerSprite.py,sha256=4Zhy94TWbsgXQTRM4xwIMHo5YPFmsfb1xjM3dmv207g,3542
17
+ GameBox/tilemap/_Editor.py,sha256=98JcwAvL6JgSG2S-V-527lwpfzbE-A-BbezCI9EfTyI,1027
18
+ GameBox/tilemap/_collisionDef.py,sha256=VxWcfz3nlhyYI_Hemp-LvC6IDC-YN6wIdRaU8AsgipU,1621
19
+ GameBox/tilemap/_editorBrushes.py,sha256=GFfRV0OB3t9sFb37eO3sB8Cmwyd5i_q64q5IjYlkx1k,7247
20
+ GameBox/tilemap/_tilemap.py,sha256=K_L7jNWrmVnnOSrrqj0aasVuJMHsTpScGj3adrnKJC0,3820
21
+ GameBox/ui/_basicUI.py,sha256=gP8jhKo7cHH5GlKNH4DFqEziX9dIv0YxsaoFceteB1k,1778
22
+ gamebox-0.9.0.dist-info/METADATA,sha256=4IQDtldYyMYbzsRyZP8fkj5DWErEL_CYib1nQO8BkEo,1059
23
+ gamebox-0.9.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
24
+ gamebox-0.9.0.dist-info/licenses/LICENSE,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
25
+ gamebox-0.9.0.dist-info/RECORD,,
@@ -1,19 +0,0 @@
1
- GameBox/__init__.py,sha256=jU3a32yFDiWvSHanU2_xJHNi3Ngcqrvjn190SyKlNwE,727
2
- GameBox/_game.py,sha256=QqfWQRLIiKQ-QjEGQYFLpsjEtPNuhxMqiCnPmXFyq3M,1548
3
- GameBox/basics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- GameBox/basics/_net.py,sha256=tZsfUc-rOsbRPxgjzR95gY6vKa8CxM8TJhCBtDnVhtg,766
5
- GameBox/basics/_shapes.py,sha256=7k5Mxnm_NdFssW6Zao8DSJAHJQM3pVWx2xZ4QDyF6lQ,1035
6
- GameBox/basics/cammera.py,sha256=qo20hc5f3FLiBpFeWgBObj-EQ93Hg4RgEUtIwPIylOI,930
7
- GameBox/basics/utils.py,sha256=w6H34MhxcNoX58iQtlvbT5-4GXefy3RIMTxZGP9fSxA,432
8
- GameBox/helpers/_collisions.py,sha256=f19oIYsyY3G9-5J-nUVBvbuFT1EPeDwcbycIP0TLGms,4336
9
- GameBox/helpers/_input.py,sha256=97bPxM5dkonRywOhj11lgHVQVicuLAKYi_w8EPM0Af8,1963
10
- GameBox/player/_player.py,sha256=R0vH1mZhl6RENiQl3Vg4ACF9agR5OP50MenvhgFBYOk,1769
11
- GameBox/player/_playerControler.py,sha256=XEb87RFlgLFoXnXqxIS4lpzHN0wywMNCX5y-NIhw0cs,1715
12
- GameBox/player/_playerPhysics.py,sha256=XqgEC5FB5mrnlalY3M5TLScw40mSvNAc0AE9g3amEr0,2918
13
- GameBox/tilemap/_Editor.py,sha256=Xed3Q33WEAKyLiTieTWDFeiTMMQm8m7cY2Bv7JzJr0o,4010
14
- GameBox/tilemap/_collisionDef.py,sha256=lZCmSwIsLgxvEB3X30re_izg1DHY83IWp84NcM1cIkM,1393
15
- GameBox/tilemap/_tilemap.py,sha256=fIBaAAu1Rg1iI4xEUk3Xkpe4MllpnkLzNfInj0468cw,3292
16
- gamebox-0.2.0.dist-info/METADATA,sha256=2nL3q0Sg_b_tyg-shYRDrlpNAXJ0MzsZy_5tmWhdKcg,1059
17
- gamebox-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
18
- gamebox-0.2.0.dist-info/licenses/LICENSE,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
19
- gamebox-0.2.0.dist-info/RECORD,,