GameBox 0.2.0__tar.gz → 0.3.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 (26) hide show
  1. {gamebox-0.2.0 → gamebox-0.3.0}/PKG-INFO +1 -1
  2. {gamebox-0.2.0 → gamebox-0.3.0}/pyproject.toml +1 -1
  3. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/__init__.py +1 -1
  4. gamebox-0.3.0/src/GameBox/tilemap/_Editor.py +36 -0
  5. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/tilemap/_collisionDef.py +7 -0
  6. gamebox-0.3.0/src/GameBox/tilemap/_editorBrushes.py +166 -0
  7. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/tilemap/_tilemap.py +3 -1
  8. {gamebox-0.2.0 → gamebox-0.3.0}/tests/basicScreen.py +3 -2
  9. gamebox-0.3.0/tests/testMap.json +1 -0
  10. gamebox-0.2.0/src/GameBox/tilemap/_Editor.py +0 -101
  11. gamebox-0.2.0/tests/testMap.json +0 -1
  12. {gamebox-0.2.0 → gamebox-0.3.0}/.gitignore +0 -0
  13. {gamebox-0.2.0 → gamebox-0.3.0}/LICENSE +0 -0
  14. {gamebox-0.2.0 → gamebox-0.3.0}/README.md +0 -0
  15. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/_game.py +0 -0
  16. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/basics/__init__.py +0 -0
  17. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/basics/_net.py +0 -0
  18. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/basics/_shapes.py +0 -0
  19. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/basics/cammera.py +0 -0
  20. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/basics/utils.py +0 -0
  21. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/helpers/_collisions.py +0 -0
  22. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/helpers/_input.py +0 -0
  23. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/player/_player.py +0 -0
  24. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/player/_playerControler.py +0 -0
  25. {gamebox-0.2.0 → gamebox-0.3.0}/src/GameBox/player/_playerPhysics.py +0 -0
  26. {gamebox-0.2.0 → gamebox-0.3.0}/tests/levelTiles.png +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameBox
3
- Version: 0.2.0
3
+ Version: 0.3.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
@@ -3,7 +3,7 @@ requires = ["hatchling >= 1.26"]
3
3
  build-backend = "hatchling.build"
4
4
  [project]
5
5
  name = "GameBox"
6
- version = "0.2.0"
6
+ version = "0.3.0"
7
7
  authors = [
8
8
  { name="Sam Fertig", email="sfertig007@gmail.com" },
9
9
  ]
@@ -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____
@@ -0,0 +1,36 @@
1
+ import pygame
2
+ import numpy as np
3
+
4
+ from..helpers._input import Keys
5
+ from ..basics._net import Global
6
+ from ._collisionDef import _tileCollisionDefs
7
+
8
+ from._editorBrushes import _brushPencil, _collisionsPencil
9
+
10
+ class _tilemapEditor:
11
+ def __init__(self, tilemap, activation):
12
+ self.tilemap = tilemap
13
+ self.activation = activation
14
+ self.active = False
15
+
16
+ self.mode = _brushPencil()
17
+
18
+ self.changes = {
19
+ "pencil": Keys.b,
20
+ "collisions": Keys.c
21
+
22
+ }
23
+
24
+ def _update(self):
25
+ if self.active:
26
+ self.change_mode()
27
+ #editor stuff
28
+ self.mode.update(self.tilemap)
29
+ #toggle
30
+ if Keys.is_pressed(self.activation): self.active = not self.active
31
+
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
+
@@ -17,6 +17,8 @@ class TileMap:
17
17
  self.tilescale = tileScale
18
18
  self.orginDim = tileDim
19
19
 
20
+ self.tilesetNum = 0
21
+
20
22
  self.editor = None
21
23
 
22
24
  Global.game.objs.append(self)
@@ -46,10 +48,10 @@ class TileMap:
46
48
  self.tiles[tile_id] = pygame.transform.scale(tile, self.tileDim)
47
49
  self.tilePosInImage[tile_id] = (x, y)
48
50
  self.posToTile[(x, y)] = tile_id
51
+ self.tilesetNum += 1
49
52
  tile_id += 1
50
53
 
51
54
  Global.tilemap.append(self)
52
- print(self.posToTile)
53
55
 
54
56
  def load_map_from_json(self, filePath: str):
55
57
  with open(filePath, "r") as f:
@@ -10,7 +10,7 @@ Keys.init()
10
10
 
11
11
  cam = Cammera()
12
12
 
13
- player = Player((width / 2, height / 4), (50, 50), "green", False)
13
+ player = Player((width / 2, height / 4), (50, 50), "green", False)
14
14
  player.add_physics(1.0, 3.0, 16, 7.0, 0.5)
15
15
 
16
16
  map = TileMap("tests/levelTiles.png", (16, 16), 5, (25, 25), 0)
@@ -35,6 +35,7 @@ while running:
35
35
 
36
36
  game.update(events, 60)
37
37
 
38
- os.system("cls")
38
+
39
39
  game.quit()
40
40
  pygame.quit()
41
+ os.system("cls")
@@ -0,0 +1 @@
1
+ {"map": [[11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 1, 2, 3, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 7, 8, 9, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 13, 14, 15, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 4, 5, 6, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 10, 11, 12, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 16, 17, 18, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]], "collisions": {"1": "full", "2": "halfTop", "7": "halfLeft", "3": "full", "13": "full", "15": "full", "9": "halfRight", "14": "halfBottom", "8": "none", "6": "bottomLeft", "5": "halfBottom", "4": "bottomRight", "10": "halfRight", "16": "topRight", "12": "halfLeft", "11": "none", "18": "topLeft", "17": "halfTop"}}
@@ -1,101 +0,0 @@
1
- import pygame
2
- import numpy as np
3
-
4
- from..helpers._input import Keys
5
- from ..basics._net import Global
6
-
7
- class _tilemapEditor:
8
- def __init__(self, tilemap, activation):
9
- self.tilemap = tilemap
10
- self.activation = activation
11
- self.active = False
12
-
13
- self.selectedTile = 1
14
- self.mx, self.my = Keys.mouse_x, Keys.mouse_y
15
-
16
- self.mode = "paint"
17
-
18
- def _update(self):
19
- 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
-
31
- #toggle
32
- if Keys.is_pressed(self.activation): self.active = not self.active
33
-
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
-
@@ -1 +0,0 @@
1
- {"map": [[11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 1, 2, 2, 2, 2, 3, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 7, 8, 8, 8, 8, 9, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 7, 8, 8, 8, 8, 9, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 7, 8, 8, 8, 8, 9, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 7, 8, 8, 8, 8, 9, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 13, 14, 14, 14, 14, 15, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 11, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8], [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8]], "collisions": {}}
File without changes
File without changes
File without changes
File without changes
File without changes