devpace 1.0.0__tar.gz → 1.1.1__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.
- {devpace-1.0.0 → devpace-1.1.1}/PKG-INFO +0 -0
- devpace-1.1.1/README.md +1 -0
- {devpace-1.0.0 → devpace-1.1.1}/pyproject.toml +1 -1
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/__init__.py +6 -2
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/_net.py +0 -1
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/helpers/_tilemap_files.py +1 -2
- devpace-1.1.1/src/devpace/helpers/timers.py +45 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/main.py +5 -2
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/physics/collisions.py +16 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/physics/dynamicBody.py +20 -1
- devpace-1.0.0/README.md +0 -0
- devpace-1.0.0/src/devPace/tracker.txt +0 -13
- {devpace-1.0.0 → devpace-1.1.1}/.gitignore +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/LICENSE +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/GlobalDebugger.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/assets/animations.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/assets/cache.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/assets/images.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/assets/text.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/assets/tilemap.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/basics/camera.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/basics/input.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/basics/shapes.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/helpers/_tilemapEditor.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/helpers/utils.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/physics/KinematicPlatform.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.1/src/devpace}/physics/StateManager.py +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/tests/assets/PL #3 Species(Grass & flowers).png +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/tests/assets/TileSet/PL #1 TileSet(Ground).png +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/tests/assets/TileSet/PL #1 TileSet(Lava Animation).png +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/tests/assets/TileSet/PL #1 TileSet(Water Animation).png +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/tests/assets/levelTiles.png +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/tests/assets/test.png +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/tests/game.json +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/tests/platformergame.py +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/tests/props.json +0 -0
- {devpace-1.0.0 → devpace-1.1.1}/tests/test.json +0 -0
|
Binary file
|
devpace-1.1.1/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a pygame engine build
|
|
@@ -3,7 +3,7 @@ Pygame Engine
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
__version__ = "1.
|
|
6
|
+
__version__ = "1.1.1"
|
|
7
7
|
__author__ = "Sam Fertig"
|
|
8
8
|
|
|
9
9
|
#____imports____
|
|
@@ -14,10 +14,12 @@ from .basics.shapes import Rect, Circle
|
|
|
14
14
|
from .assets.cache import Assets
|
|
15
15
|
from .assets.images import Image
|
|
16
16
|
from .physics.dynamicBody import DynamicBody
|
|
17
|
+
from .physics.collisions import Area2D
|
|
17
18
|
from .physics.KinematicPlatform import KinematicPlatform
|
|
18
19
|
from .assets.tilemap import Tilemap, TILEMAP_COLLISION_GEN
|
|
19
20
|
from .assets.animations import AnimationManager
|
|
20
21
|
from .physics.StateManager import StateManager, AutoStateManager
|
|
22
|
+
from .helpers.timers import Timer
|
|
21
23
|
|
|
22
24
|
__all__ = [
|
|
23
25
|
"Engine",
|
|
@@ -30,10 +32,12 @@ __all__ = [
|
|
|
30
32
|
"Assets",
|
|
31
33
|
"Image",
|
|
32
34
|
"DynamicBody",
|
|
35
|
+
"Area2D",
|
|
33
36
|
"KinematicPlatform",
|
|
34
37
|
"Tilemap",
|
|
35
38
|
"TILEMAP_COLLISION_GEN",
|
|
36
39
|
"AnimationManager",
|
|
37
40
|
"StateManager",
|
|
38
|
-
"AutoStateManager"
|
|
41
|
+
"AutoStateManager",
|
|
42
|
+
"Timer",
|
|
39
43
|
]
|
|
@@ -94,8 +94,7 @@ def gen_collision_shapes(self, COL_FULL, COL_HALF_TOP, COL_HALF_BOTTOM, COL_HALF
|
|
|
94
94
|
# CORRECTION: Make sure generated rectangles are actually added to your active collisions list
|
|
95
95
|
for i in _tiles:
|
|
96
96
|
self.collisions.append(i)
|
|
97
|
-
|
|
98
|
-
#print(len(Global.collisions))
|
|
97
|
+
|
|
99
98
|
|
|
100
99
|
def _gen_tiles_left_right(_tiles: list[CollisionRect], used: list, _pos_list: list[tuple], self, SEARCH_TIME: int, shape: CollisionRect):
|
|
101
100
|
used.clear()
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import pygame
|
|
2
|
+
from .._net import Global
|
|
3
|
+
|
|
4
|
+
class Timer:
|
|
5
|
+
def __init__(self, duration, loops=False):
|
|
6
|
+
self.duration = duration # Time in seconds (e.g., 2.0 for two seconds)
|
|
7
|
+
self.loops = loops
|
|
8
|
+
self.time_elapsed = 0.0
|
|
9
|
+
self.active = True
|
|
10
|
+
self.triggered = False
|
|
11
|
+
|
|
12
|
+
Global.add_object(0, self)
|
|
13
|
+
|
|
14
|
+
def update(self):
|
|
15
|
+
if not self.active:
|
|
16
|
+
return
|
|
17
|
+
|
|
18
|
+
self.triggered = False
|
|
19
|
+
self.time_elapsed += Global.dt
|
|
20
|
+
|
|
21
|
+
if self.time_elapsed >= self.duration:
|
|
22
|
+
self.triggered = True
|
|
23
|
+
if self.loops:
|
|
24
|
+
self.time_elapsed = 0.0 # Reset and loop
|
|
25
|
+
else:
|
|
26
|
+
self.active = False # Stop running
|
|
27
|
+
|
|
28
|
+
def start(self):
|
|
29
|
+
self.time_elapsed = 0.0
|
|
30
|
+
self.active = True
|
|
31
|
+
self.triggered = False
|
|
32
|
+
|
|
33
|
+
def stop(self):
|
|
34
|
+
self.active = False
|
|
35
|
+
|
|
36
|
+
def is_done(self):
|
|
37
|
+
return not self.active
|
|
38
|
+
|
|
39
|
+
def reset(self, new_time = None):
|
|
40
|
+
if new_time is None:
|
|
41
|
+
self.time_elapsed = 0.0
|
|
42
|
+
else:
|
|
43
|
+
self.time_elapsed = new_time
|
|
44
|
+
|
|
45
|
+
self.active = True
|
|
@@ -21,7 +21,6 @@ class Engine:
|
|
|
21
21
|
pygame.display.set_caption(title)
|
|
22
22
|
|
|
23
23
|
if EXPERIMENTAL_DEBUG:
|
|
24
|
-
print("Starting GlobalDebugger...")
|
|
25
24
|
self.log_queue = multiprocessing.Queue()
|
|
26
25
|
self.debug_prossess = multiprocessing.Process(target=GlobalDebugger, args=(self.log_queue,)).start()
|
|
27
26
|
|
|
@@ -127,8 +126,12 @@ class Engine:
|
|
|
127
126
|
CollisionRect(self.screen_dim[0], 0, 5, self.screen_dim[1], ALL_COLLISION_LAYERS)
|
|
128
127
|
CollisionRect(0, self.screen_dim[1], self.screen_dim[0], 5, ALL_COLLISION_LAYERS)
|
|
129
128
|
|
|
129
|
+
def remove_obj(self, obj):
|
|
130
|
+
if obj.layer in Global.objects:
|
|
131
|
+
if obj in Global.objects[obj.layer]:
|
|
132
|
+
Global.objects[obj.layer].remove(obj)
|
|
133
|
+
|
|
130
134
|
def _func_get_global_(self) -> _global_:
|
|
131
|
-
print("<Engine> Global accsesed")
|
|
132
135
|
return Global
|
|
133
136
|
|
|
134
137
|
def get_current_fps(self):
|
|
@@ -38,3 +38,19 @@ class CollisionRect:
|
|
|
38
38
|
rect.x = self.x-Global.cam.x
|
|
39
39
|
rect.y = self.y-Global.cam.y
|
|
40
40
|
pygame.draw.rect(Global.screen, self.color, rect)
|
|
41
|
+
|
|
42
|
+
class Area2D:
|
|
43
|
+
def __init__(self, x, y, width, height, layers=[]):
|
|
44
|
+
self.x, self.y = x, y
|
|
45
|
+
self.width, self.height = width, height
|
|
46
|
+
self.layers = layers
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def rect(self):
|
|
50
|
+
return pygame.Rect(self.x, self.y, self.width, self.height)
|
|
51
|
+
|
|
52
|
+
def is_colliding_with(self, area):
|
|
53
|
+
if self.rect().colliderect(area.rect()):
|
|
54
|
+
for layer in self.layers:
|
|
55
|
+
if layer in area.layers: return True
|
|
56
|
+
else: return False
|
|
@@ -3,11 +3,13 @@ from .._net import Global
|
|
|
3
3
|
from ..helpers.utils import change_layer
|
|
4
4
|
from .collisions import CollisionRect
|
|
5
5
|
class DynamicBody:
|
|
6
|
-
def __init__(self, x, y, width, height, vx=0.0, vy=0.0, show=True, layer=3, gravity=0.0, smartCollisions=True, smartCollisionDist=1):
|
|
6
|
+
def __init__(self, x, y, width, height, vx=0.0, vy=0.0, max_vx=None, max_vy=None, show=True, layer=3, gravity=0.0, smartCollisions=True, smartCollisionDist=1):
|
|
7
7
|
self.x = x
|
|
8
8
|
self.y = y
|
|
9
9
|
self.vx = vx
|
|
10
10
|
self.vy = vy
|
|
11
|
+
self.max_vx = max_vx
|
|
12
|
+
self.max_vy = max_vy
|
|
11
13
|
self.width = width
|
|
12
14
|
self.height = height
|
|
13
15
|
self.show = show
|
|
@@ -23,6 +25,7 @@ class DynamicBody:
|
|
|
23
25
|
self.image = None
|
|
24
26
|
self.animation = None
|
|
25
27
|
self.animationManager = None
|
|
28
|
+
self.area2D = None
|
|
26
29
|
|
|
27
30
|
#collision checks
|
|
28
31
|
self.smartCollisions = smartCollisions
|
|
@@ -49,6 +52,19 @@ class DynamicBody:
|
|
|
49
52
|
self.is_on_right = False
|
|
50
53
|
self.is_on_wall = False
|
|
51
54
|
|
|
55
|
+
#clamps
|
|
56
|
+
if self.max_vx != None:
|
|
57
|
+
if self.vx > self.max_vx:
|
|
58
|
+
self.vx = self.max_vx
|
|
59
|
+
elif self.vx < -self.max_vx:
|
|
60
|
+
self.vx = -self.max_vx
|
|
61
|
+
|
|
62
|
+
if self.max_vy != None:
|
|
63
|
+
if self.vy > self.max_vy:
|
|
64
|
+
self.vy = self.max_vy
|
|
65
|
+
elif self.vy < -self.max_vy:
|
|
66
|
+
self.vy = -self.max_vy
|
|
67
|
+
|
|
52
68
|
#x movement
|
|
53
69
|
self.x+=self.vx*Global.dt
|
|
54
70
|
#if collisions, back up
|
|
@@ -132,4 +148,7 @@ class DynamicBody:
|
|
|
132
148
|
if self.animationManager is not None:
|
|
133
149
|
self.animationManager.x = self.x
|
|
134
150
|
self.animationManager.y = self.y
|
|
151
|
+
if self.area2D is not None:
|
|
152
|
+
self.area2D.x = self.x
|
|
153
|
+
self.area2D.y = self.y
|
|
135
154
|
|
devpace-1.0.0/README.md
DELETED
|
Binary file
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
This file is for tracking progress on certain parts of the project
|
|
2
|
-
|
|
3
|
-
TILEMAP:
|
|
4
|
-
v1
|
|
5
|
-
basic tiles laoding and saving with simple rendering
|
|
6
|
-
|
|
7
|
-
TILEMAP EDITOR:
|
|
8
|
-
v1
|
|
9
|
-
opens window for placing and removing tiles, with arrow key tile switching
|
|
10
|
-
|
|
11
|
-
TILEMAP COLLISION GEN:
|
|
12
|
-
v1
|
|
13
|
-
Generates seperate collisionRects for each tile.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|