GameBox 0.0.5__py3-none-any.whl → 0.1.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.
- GameBox/__init__.py +9 -18
- GameBox/_game.py +38 -0
- GameBox/basics/_net.py +29 -0
- GameBox/basics/_shapes.py +23 -0
- GameBox/basics/cammera.py +30 -0
- GameBox/basics/utils.py +17 -0
- GameBox/player/_player.py +35 -0
- GameBox/player/_playerControler.py +54 -0
- GameBox/player/_playerPhysics.py +105 -0
- gamebox-0.1.0.dist-info/METADATA +20 -0
- gamebox-0.1.0.dist-info/RECORD +14 -0
- {gamebox-0.0.5.dist-info → gamebox-0.1.0.dist-info}/WHEEL +1 -1
- GameBox/basics/Defaults.json +0 -12
- GameBox/basics/Functions.py +0 -43
- GameBox/basics/_core.py +0 -41
- GameBox/basics/camera.py +0 -14
- GameBox/basics/player.py +0 -284
- GameBox/basics/shapes.py +0 -30
- GameBox/entities/basicNPCs.py +0 -21
- GameBox/entities/basicTypes.py +0 -79
- GameBox/game.py +0 -30
- GameBox/inputs/BasicInput.py +0 -11
- GameBox/sound/BasicSound.py +0 -66
- GameBox/tilemap/editor.py +0 -267
- GameBox/tilemap/tilemap.py +0 -146
- gamebox-0.0.5.dist-info/METADATA +0 -40
- gamebox-0.0.5.dist-info/RECORD +0 -19
- {gamebox-0.0.5.dist-info → gamebox-0.1.0.dist-info}/licenses/LICENSE +0 -0
GameBox/tilemap/editor.py
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import pygame
|
|
2
|
-
import math
|
|
3
|
-
from ..basics.Functions import DisplayText
|
|
4
|
-
from ..basics.Functions import getTilePosInGrid as getTilePos
|
|
5
|
-
|
|
6
|
-
class Editor:
|
|
7
|
-
def __init__(self, tilesize, file, winDim, fileDim, imageDict, layers, size, currentLayer, C_tiles, C_Data):
|
|
8
|
-
print("""====INGAME EDITOR ENABLED, PRESS "e" TO USE====""")
|
|
9
|
-
self.Tsize = tilesize
|
|
10
|
-
self.image = file
|
|
11
|
-
self.width = winDim[0]
|
|
12
|
-
self.height = winDim[1]
|
|
13
|
-
self.fileDim = fileDim
|
|
14
|
-
self.images = imageDict
|
|
15
|
-
self.layers = layers
|
|
16
|
-
self.currentLayer = currentLayer
|
|
17
|
-
|
|
18
|
-
self.active = False
|
|
19
|
-
self.Constdis = {
|
|
20
|
-
"title" : "TileMap Editor",
|
|
21
|
-
"T_color" : "white",
|
|
22
|
-
"T_size" : 50,
|
|
23
|
-
"T_pos" : (self.width-(self.width/4)+40, self.height-(self.height/6)+40)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
self.state = "standby"
|
|
27
|
-
self.selectedTile = (0, 0)
|
|
28
|
-
self.SelTileDict = [0, 0]
|
|
29
|
-
self.DictPos = (0, 0)
|
|
30
|
-
self.imageSize = size
|
|
31
|
-
self.collision = C_tiles
|
|
32
|
-
self.Cdata = C_Data
|
|
33
|
-
self.Col = {
|
|
34
|
-
"state" : "standby",
|
|
35
|
-
"selected": "none",
|
|
36
|
-
"exit": False
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
#self.space_pressed_last = False
|
|
40
|
-
|
|
41
|
-
def update(self, cam):
|
|
42
|
-
keys = pygame.key.get_pressed()
|
|
43
|
-
|
|
44
|
-
if keys[pygame.K_e] and not self.e_pressed_last:
|
|
45
|
-
self.active = not self.active
|
|
46
|
-
self.e_pressed_last = keys[pygame.K_e]
|
|
47
|
-
if self.active:
|
|
48
|
-
self.key_toggles(keys)
|
|
49
|
-
else:
|
|
50
|
-
self.resetStates()
|
|
51
|
-
#erase tiles
|
|
52
|
-
if pygame.mouse.get_pressed(3)[2] and self.active:
|
|
53
|
-
mx, my = pygame.mouse.get_pos()
|
|
54
|
-
# Convert mouse to world coordinates
|
|
55
|
-
world_x = mx + cam.pos[0]
|
|
56
|
-
world_y = my + cam.pos[1]
|
|
57
|
-
# Snap to grid
|
|
58
|
-
x, y = getTilePos((world_x, world_y), self.Tsize)
|
|
59
|
-
# Remove any tile at that world grid position
|
|
60
|
-
tiles = self.layers[self.currentLayer]
|
|
61
|
-
tiles = [tile for tile in tiles if tile[1] != [x, y]]
|
|
62
|
-
self.layers[self.currentLayer] = tiles
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def display(self, screen, cam):
|
|
66
|
-
if self.active:
|
|
67
|
-
self.basicUI(screen)
|
|
68
|
-
if self.state == "picking":
|
|
69
|
-
self.Picking(screen)
|
|
70
|
-
if self.state == "paint":
|
|
71
|
-
self.Paint(screen, cam)
|
|
72
|
-
if self.state == "collisionEditing":
|
|
73
|
-
self.collision_editing(screen)
|
|
74
|
-
|
|
75
|
-
def collision_editing(self, screen):
|
|
76
|
-
screen.fill("black")
|
|
77
|
-
screen.blit(self.image, (0, 0))
|
|
78
|
-
self.collision_Base_ui(screen)
|
|
79
|
-
self.collisionOverlay(screen)
|
|
80
|
-
if self.Col["state"] == "painting":
|
|
81
|
-
if pygame.mouse.get_pos()[1] > self.height - self.height//6 and self.Col["exit"]:
|
|
82
|
-
self.Col["exit"] = False
|
|
83
|
-
self.Col["state"] = "standby"
|
|
84
|
-
data = self.Cdata[self.Col['selected']]
|
|
85
|
-
#tile to follow mouse
|
|
86
|
-
x, y = pygame.mouse.get_pos()
|
|
87
|
-
pos = (getTilePos((x, y), self.imageSize))
|
|
88
|
-
pygame.draw.rect(screen, "yellow", pygame.Rect((pos[0]*self.imageSize+data[0][0], pos[1]*self.imageSize+data[0][1]), data[1]))
|
|
89
|
-
if pygame.mouse.get_pressed(3)[0] and self.Col["exit"]:
|
|
90
|
-
#get index
|
|
91
|
-
index = getTilePos(pygame.mouse.get_pos(), self.imageSize)
|
|
92
|
-
x, y = index
|
|
93
|
-
if x<self.fileDim[0] and y<self.fileDim[1] and x>=0 and y>=0:
|
|
94
|
-
self.collision[str([x, y])] = self.Col["selected"]
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def collisionOverlay(self, screen):
|
|
98
|
-
x, y = 0, self.fileDim[1]*self.imageSize+25
|
|
99
|
-
screen.blit(self.image, (0, y))
|
|
100
|
-
rect = pygame.Rect(x, y, self.fileDim[0]*self.imageSize, self.fileDim[1]*self.imageSize)
|
|
101
|
-
pygame.draw.rect(screen, "white", rect, 2)
|
|
102
|
-
for value in self.collision.values():
|
|
103
|
-
data = self.Cdata[value]
|
|
104
|
-
if value != "none":
|
|
105
|
-
pygame.draw.rect(screen, "yellow", pygame.Rect((data[0][0]+x, data[0][1]+y), data[1]))
|
|
106
|
-
x+=self.imageSize
|
|
107
|
-
if x>=self.fileDim[0]*self.imageSize:
|
|
108
|
-
y+=self.imageSize
|
|
109
|
-
x=0
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
def collision_Base_ui(self, screen):
|
|
113
|
-
pygame.draw.rect(screen, "gray", pygame.Rect((0, self.height-self.height//6), (self.width, self.height-self.height//6)))
|
|
114
|
-
self.basicUI(screen)
|
|
115
|
-
#display tileset
|
|
116
|
-
#display collision paintable tiles
|
|
117
|
-
x = 0
|
|
118
|
-
y = (self.height - self.height//6)
|
|
119
|
-
for tile in self.Cdata:
|
|
120
|
-
data = self.Cdata[tile]
|
|
121
|
-
if tile!="none":
|
|
122
|
-
pygame.draw.rect(screen, "yellow", pygame.Rect(data[0][0]+x, data[0][1]+y, data[1][0], data[1][1]))
|
|
123
|
-
else:
|
|
124
|
-
pygame.draw.rect(screen, "green", pygame.Rect(data[0][0]+x, data[0][1]+y, data[1][0], data[1][1]), 7)
|
|
125
|
-
x+=self.Tsize
|
|
126
|
-
if pygame.mouse.get_pos()[1] < self.height - self.height//6:
|
|
127
|
-
self.collisionPointer_paint(screen)
|
|
128
|
-
else:
|
|
129
|
-
self.collisionPointer_change(screen)
|
|
130
|
-
|
|
131
|
-
if pygame.mouse.get_pos()[1] < self.height - self.height//6:
|
|
132
|
-
self.Col["exit"] = True
|
|
133
|
-
|
|
134
|
-
if pygame.mouse.get_pressed(3)[0] and pygame.mouse.get_pos()[1] >= self.height - self.height//6:
|
|
135
|
-
self.Col["exit"] = False
|
|
136
|
-
#get sellected tile position
|
|
137
|
-
x, y = pygame.mouse.get_pos()
|
|
138
|
-
nx, ny = (getTilePos((x, y), self.imageSize))
|
|
139
|
-
additive = 0
|
|
140
|
-
for i in range(nx):
|
|
141
|
-
additive+=self.imageSize/4
|
|
142
|
-
pos = nx, self.height - self.height//6
|
|
143
|
-
x, y = nx*self.imageSize, self.height//6
|
|
144
|
-
#divide to get tile index numbers
|
|
145
|
-
nx = x/self.imageSize
|
|
146
|
-
if nx%2 == 0:
|
|
147
|
-
self.Col["state"] = "painting"
|
|
148
|
-
data = list(self.Cdata.items())[int(nx//2)]
|
|
149
|
-
self.Col["selected"] = data[0]
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def collisionPointer_change(self, screen):
|
|
153
|
-
x, y = pygame.mouse.get_pos()
|
|
154
|
-
nx, ny = (getTilePos((x, y), self.imageSize))
|
|
155
|
-
additive = 0
|
|
156
|
-
for i in range(nx):
|
|
157
|
-
additive+=self.imageSize/4
|
|
158
|
-
pos = nx, self.height - self.height//6
|
|
159
|
-
pygame.draw.rect(screen, "white", pygame.Rect((pos[0]*self.imageSize, pos[1]), (self.imageSize, self.imageSize)), 2)
|
|
160
|
-
|
|
161
|
-
def collisionPointer_paint(self, screen):
|
|
162
|
-
x, y = pygame.mouse.get_pos()
|
|
163
|
-
pos = (getTilePos((x, y), self.imageSize))
|
|
164
|
-
pygame.draw.rect(screen, "white", pygame.Rect((pos[0]*self.imageSize, pos[1]*self.imageSize), (self.imageSize, self.imageSize)), 2)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
def Paint(self, screen, cam):
|
|
169
|
-
mx, my = pygame.mouse.get_pos()
|
|
170
|
-
# 1. Convert screen pos → world pos
|
|
171
|
-
world_x = mx + cam.pos[0]
|
|
172
|
-
world_y = my + cam.pos[1]
|
|
173
|
-
# 2. Snap world pos → grid
|
|
174
|
-
x, y = getTilePos((world_x, world_y), self.Tsize)
|
|
175
|
-
# 3. Draw highlight (subtract camera for screen-space display)
|
|
176
|
-
pygame.draw.rect(
|
|
177
|
-
screen, "white",
|
|
178
|
-
pygame.Rect(x*self.Tsize - cam.pos[0], y*self.Tsize - cam.pos[1], self.Tsize, self.Tsize),
|
|
179
|
-
5
|
|
180
|
-
)
|
|
181
|
-
# 4. Place tile in world grid space
|
|
182
|
-
if pygame.mouse.get_pressed(3)[0]:
|
|
183
|
-
tiles = self.layers[self.currentLayer]
|
|
184
|
-
tiles = [tile for tile in tiles if tile[1] != [x, y]]
|
|
185
|
-
tiles.append([self.SelTileDict, [x, y]])
|
|
186
|
-
self.layers[self.currentLayer] = tiles
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def Picking(self, screen):
|
|
190
|
-
#display tileset / tile follow mouse
|
|
191
|
-
screen.blit(self.image, (10, 10))
|
|
192
|
-
x, y = pygame.mouse.get_pos()
|
|
193
|
-
pos = getTilePos((int(x), int(y)), self.imageSize) # (grid_x, grid_y)
|
|
194
|
-
x = ((pos[0]) * self.imageSize)+10
|
|
195
|
-
y = ((pos[1]) * self.imageSize)+10
|
|
196
|
-
pygame.draw.rect(screen, "white", pygame.Rect((x, y), (self.imageSize, self.imageSize)), 2)
|
|
197
|
-
#wait for selection
|
|
198
|
-
X = int(pos[0])
|
|
199
|
-
Y = int(pos[1])
|
|
200
|
-
if pygame.mouse.get_pressed(3)[0] and X<self.fileDim[0] and Y<self.fileDim[1]:
|
|
201
|
-
self.state = "paint"
|
|
202
|
-
#get sellected tile
|
|
203
|
-
self.selectedTile = self.images[str([X,Y])]
|
|
204
|
-
self.SelTileDict = [X, Y]
|
|
205
|
-
self.DF_DictPos(screen,pos[0], pos[1])
|
|
206
|
-
|
|
207
|
-
def DF_DictPos(self, screen, x, y):
|
|
208
|
-
DisplayText(str((x, y)), "green", 35, (self.width//2, self.height//2), screen)
|
|
209
|
-
DisplayText(str(self.imageSize), "green", 35, (self.width//2, self.height//2-50), screen)
|
|
210
|
-
|
|
211
|
-
def key_toggles(self, keys):
|
|
212
|
-
#toggle
|
|
213
|
-
if keys[pygame.K_TAB] and self.active:
|
|
214
|
-
#pick tile
|
|
215
|
-
self.state = "picking"
|
|
216
|
-
if keys[pygame.K_ESCAPE] and self.state == "picking":
|
|
217
|
-
self.state = "standby"
|
|
218
|
-
elif keys[pygame.K_ESCAPE] and self.state == "paint":
|
|
219
|
-
self.state = "picking"
|
|
220
|
-
elif keys[pygame.K_c]:
|
|
221
|
-
self.state = "collisionEditing"
|
|
222
|
-
self.switchLayers(keys)
|
|
223
|
-
|
|
224
|
-
def switchLayers(self, keys):
|
|
225
|
-
if keys[pygame.K_SPACE] and not self.space_pressed_last:
|
|
226
|
-
layer_names = list(self.layers.keys())
|
|
227
|
-
idx = layer_names.index(self.currentLayer)
|
|
228
|
-
self.currentLayer = layer_names[(idx + 1) % len(layer_names)]
|
|
229
|
-
self.space_pressed_last = keys[pygame.K_SPACE]
|
|
230
|
-
|
|
231
|
-
def resetStates(self):
|
|
232
|
-
self.state = "standby"
|
|
233
|
-
|
|
234
|
-
def basicUI(self, screen):
|
|
235
|
-
# Panel size scales with window
|
|
236
|
-
panel_w = int(self.width * 0.25) # 25% of screen width
|
|
237
|
-
panel_h = int(self.height * 0.2) # 20% of screen height
|
|
238
|
-
panel_x = self.width - panel_w
|
|
239
|
-
panel_y = self.height - panel_h
|
|
240
|
-
panel_rect = pygame.Rect(panel_x, panel_y, panel_w, panel_h)
|
|
241
|
-
|
|
242
|
-
# Draw background
|
|
243
|
-
pygame.draw.rect(screen, (136, 148, 150), panel_rect)
|
|
244
|
-
|
|
245
|
-
# Dynamic font sizes based on panel height
|
|
246
|
-
title_size = max(20, panel_h // 6) # min 20 to avoid being too small
|
|
247
|
-
text_size = max(15, panel_h // 8)
|
|
248
|
-
|
|
249
|
-
margin = 20
|
|
250
|
-
|
|
251
|
-
# Title
|
|
252
|
-
DisplayText(self.Constdis["title"], self.Constdis["T_color"], title_size,
|
|
253
|
-
(panel_x + margin, panel_y + margin), screen)
|
|
254
|
-
|
|
255
|
-
# State & Layer
|
|
256
|
-
DisplayText(f"State: {self.state}", "white", text_size,
|
|
257
|
-
(panel_x + margin, panel_y + margin + text_size + 5), screen)
|
|
258
|
-
|
|
259
|
-
DisplayText(f"Layer: {self.currentLayer}", "white", text_size,
|
|
260
|
-
(panel_x + margin, panel_y + margin + 2 * (text_size + 5)), screen)
|
|
261
|
-
|
|
262
|
-
# Selected tile preview (anchored bottom-right inside panel)
|
|
263
|
-
if self.state == "paint":
|
|
264
|
-
tile_x = panel_x + panel_w - self.Tsize - margin
|
|
265
|
-
tile_y = panel_y + panel_h - self.Tsize - margin
|
|
266
|
-
screen.blit(self.selectedTile, (tile_x, tile_y))
|
|
267
|
-
|
GameBox/tilemap/tilemap.py
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import pygame
|
|
2
|
-
import json
|
|
3
|
-
from .editor import Editor
|
|
4
|
-
from ..basics._core import GLOBAL
|
|
5
|
-
from ..basics.Functions import IsWithinBounds
|
|
6
|
-
from ..game import Game
|
|
7
|
-
|
|
8
|
-
class Tilemap:
|
|
9
|
-
def __init__(self, tileSize, fileDim, image, camera, scale=1):
|
|
10
|
-
# Scale tile size
|
|
11
|
-
self.size = int(tileSize * scale)
|
|
12
|
-
|
|
13
|
-
self.fileDim = fileDim
|
|
14
|
-
self.images = {}
|
|
15
|
-
self.currentLayer = "ground"
|
|
16
|
-
self.layers = {
|
|
17
|
-
"ground": []
|
|
18
|
-
}
|
|
19
|
-
self.Crect = []
|
|
20
|
-
self.collisions = {}
|
|
21
|
-
self.camera = camera
|
|
22
|
-
self.loadedImage = image
|
|
23
|
-
self.isEditor = False
|
|
24
|
-
self.scale = scale
|
|
25
|
-
self.Tsize = tileSize
|
|
26
|
-
self.createCollisionData()
|
|
27
|
-
self.screen = GLOBAL.screen
|
|
28
|
-
|
|
29
|
-
self.optim = IsWithinBounds(GLOBAL.BaseInfo["screenDim"], self.size)
|
|
30
|
-
|
|
31
|
-
# Load images (crop each tile)
|
|
32
|
-
for y in range(fileDim[1]):
|
|
33
|
-
for x in range(fileDim[0]):
|
|
34
|
-
# Create a fresh surface for this tile
|
|
35
|
-
surface = pygame.Surface((tileSize, tileSize), pygame.SRCALPHA)
|
|
36
|
-
# Define the rectangle area on the sheet
|
|
37
|
-
rect = pygame.Rect(
|
|
38
|
-
x * tileSize,
|
|
39
|
-
y * tileSize,
|
|
40
|
-
tileSize,
|
|
41
|
-
tileSize
|
|
42
|
-
)
|
|
43
|
-
# Copy the correct tile into the new surface
|
|
44
|
-
surface.blit(image, (0, 0), rect)
|
|
45
|
-
# Store it in the images dictionary
|
|
46
|
-
self.images[str([x, y])] = pygame.transform.scale(surface, (self.size, self.size))
|
|
47
|
-
|
|
48
|
-
for tileID in self.images:
|
|
49
|
-
self.collisions[tileID] = "none"
|
|
50
|
-
|
|
51
|
-
def Add_layer(self, name):
|
|
52
|
-
self.layers[name] = []
|
|
53
|
-
|
|
54
|
-
def display(self, dt):
|
|
55
|
-
self.draw_tiles()
|
|
56
|
-
if self.isEditor:
|
|
57
|
-
self.editor.update(self.camera)
|
|
58
|
-
self.editor.display(self.screen, self.camera)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def draw_tiles(self):
|
|
62
|
-
if self.isEditor:
|
|
63
|
-
self.layers = self.editor.layers
|
|
64
|
-
self.collisions = self.editor.collision
|
|
65
|
-
GLOBAL.collisions = self.Crect
|
|
66
|
-
#update rects
|
|
67
|
-
self.createCollisionRects()
|
|
68
|
-
for layer in self.layers:
|
|
69
|
-
for item in self.layers[layer]:
|
|
70
|
-
tile, pos = item
|
|
71
|
-
x = pos[0]*self.size
|
|
72
|
-
x -= self.camera.pos[0]
|
|
73
|
-
y = pos[1]*self.size
|
|
74
|
-
y -= self.camera.pos[1]
|
|
75
|
-
if self.optim.checkPos((x, y)):
|
|
76
|
-
self.screen.blit(self.images[str(tile)], (x, y))
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def createCollisionRects(self):
|
|
81
|
-
self.Crect.clear()
|
|
82
|
-
for layer in self.layers:
|
|
83
|
-
for tile in self.layers[layer]:
|
|
84
|
-
tx, ty = tile[0]
|
|
85
|
-
x, y = tile[1]
|
|
86
|
-
tile_type = self.collisions[str([tx, ty])]
|
|
87
|
-
type = self.RealCollisionTiles[tile_type]
|
|
88
|
-
if tile_type != "none":
|
|
89
|
-
x = (x*self.size)
|
|
90
|
-
y = (y*self.size)
|
|
91
|
-
x+=type[0][0] - self.camera.pos[0]
|
|
92
|
-
y+=type[0][1] - self.camera.pos[1]
|
|
93
|
-
width = type[1][0]
|
|
94
|
-
height = type[1][1]
|
|
95
|
-
self.Crect.append(pygame.Rect((x, y), (width, height)))
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def createCollisionData(self):
|
|
99
|
-
size = self.Tsize
|
|
100
|
-
self.CollisionTiles = {
|
|
101
|
-
"none": ((0, 0), (size, size)),
|
|
102
|
-
"full": ((0, 0), (size, size)),
|
|
103
|
-
"half1": ((0, 0), (size, size//2)),
|
|
104
|
-
"half2": ((0, size/2), (size, size/2)),
|
|
105
|
-
"half3": ((0, 0), (size/2, size)),
|
|
106
|
-
"half4": ((size/2, 0), (size/2, size)),
|
|
107
|
-
"center": ((size/4, size/4), (size/2, size/2))
|
|
108
|
-
}
|
|
109
|
-
#real tile sizes
|
|
110
|
-
size = self.size
|
|
111
|
-
self.RealCollisionTiles = {
|
|
112
|
-
"none": ((0, 0), (size, size)),
|
|
113
|
-
"full": ((0, 0), (size, size)),
|
|
114
|
-
"half1": ((0, 0), (size, size//2)),
|
|
115
|
-
"half2": ((0, size/2), (size, size/2)),
|
|
116
|
-
"half3": ((0, 0), (size/2, size)),
|
|
117
|
-
"half4": ((size/2, 0), (size/2, size)),
|
|
118
|
-
"center": ((size/4, size/4), (size/2, size/2))
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
def enable_editor(self, scren_width, screen_height):
|
|
124
|
-
self.isEditor = True
|
|
125
|
-
self.editor = Editor(self.size, self.loadedImage, (scren_width, screen_height), self.fileDim, self.images, self.layers, self.Tsize, self.currentLayer, self.collisions, self.CollisionTiles)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
def save_map(self, filepath):
|
|
129
|
-
with open(filepath, "w") as file:
|
|
130
|
-
data = {
|
|
131
|
-
"TileData" : self.layers,
|
|
132
|
-
"CollisionData": self.collisions
|
|
133
|
-
}
|
|
134
|
-
json.dump(data, file)
|
|
135
|
-
|
|
136
|
-
def load_map(self, filepath):
|
|
137
|
-
with open(filepath, "r") as file:
|
|
138
|
-
data = dict(json.load(file))
|
|
139
|
-
self.layers = dict(data["TileData"])
|
|
140
|
-
self.collisions = dict(data["CollisionData"])
|
|
141
|
-
self.currentLayer = "ground"
|
|
142
|
-
|
|
143
|
-
def get_editor_status(self):
|
|
144
|
-
return self.editor.active
|
|
145
|
-
|
|
146
|
-
|
gamebox-0.0.5.dist-info/METADATA
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.dist-info/RECORD
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
GameBox/__init__.py,sha256=8JdqatB1jiY958yMAz_5_XY6YIbeHvvFKMfkmRIK9sI,902
|
|
2
|
-
GameBox/game.py,sha256=UjMcqrJGVQLCyuUF8TLLnas53TKjaCx8ZWbep-oOIsM,864
|
|
3
|
-
GameBox/basics/Defaults.json,sha256=3l-bNEPWnUb-tmFrqwgSO2As35PplgkzauzT_IJGSlo,222
|
|
4
|
-
GameBox/basics/Functions.py,sha256=gjoB8GVsMR4eYAk-VTni9MCw7M6T533xj-GcgE87re0,1103
|
|
5
|
-
GameBox/basics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
GameBox/basics/_core.py,sha256=fB6KRFp3p_wD_td2uc9ZRzo0qHgUQNJ8veCaH1_eIRc,1157
|
|
7
|
-
GameBox/basics/camera.py,sha256=HwHITLEf-V4DUs-qW1lQ6uzaIaFg7kQqcGWou2IbqUY,377
|
|
8
|
-
GameBox/basics/player.py,sha256=FBo-4HfqcLtbqg_JlYcs_ohZ0RRE19k8l-PjXdDGuCQ,9483
|
|
9
|
-
GameBox/basics/shapes.py,sha256=XRVy_xbh1iPefC8IVlrZLq83zhj3d64tTF8JqJ9EcHM,932
|
|
10
|
-
GameBox/entities/basicNPCs.py,sha256=kyatewGfEGUZjf1l58Xooza5qxuo3cYEXsZBj5R9_Cg,645
|
|
11
|
-
GameBox/entities/basicTypes.py,sha256=H6Yn2duRK9P1WWRnq812g3JWBW71dBq3fINdllWW260,2714
|
|
12
|
-
GameBox/inputs/BasicInput.py,sha256=6iBwl9l9V5dZYnihxtY0MV61Rq7uUYs1Ss4ezFcKCBo,324
|
|
13
|
-
GameBox/sound/BasicSound.py,sha256=vZP62UipUzz0gZMLSHJkMyzmnnWbMaySbRfZLS-E_m0,1760
|
|
14
|
-
GameBox/tilemap/editor.py,sha256=GvHFxkybq_vbG3LAFyJWgbKvtV3fniqFdC2ByBFANC0,11008
|
|
15
|
-
GameBox/tilemap/tilemap.py,sha256=6V_gxmecrmjruhj12HMMwxZTKHeVbhTnqsrvjbAdKSE,5154
|
|
16
|
-
gamebox-0.0.5.dist-info/METADATA,sha256=BQFXRtUbFMTHpoYrgbMyRbkuuml9v_g-nV_FqB1f2VM,1759
|
|
17
|
-
gamebox-0.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
18
|
-
gamebox-0.0.5.dist-info/licenses/LICENSE,sha256=gcuuhKKc5-dwvyvHsXjlC9oM6N5gZ6umYbC8ewW1Yvg,35821
|
|
19
|
-
gamebox-0.0.5.dist-info/RECORD,,
|
|
File without changes
|