devpace 1.0.0__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {devpace-1.0.0 → devpace-1.1.0}/PKG-INFO +0 -0
- devpace-1.1.0/README.md +1 -0
- {devpace-1.0.0 → devpace-1.1.0}/pyproject.toml +1 -1
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/__init__.py +6 -2
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/_net.py +0 -1
- devpace-1.1.0/src/devpace/helpers/timers.py +37 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/main.py +4 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/physics/collisions.py +16 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/physics/dynamicBody.py +4 -0
- 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.0}/.gitignore +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/LICENSE +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/GlobalDebugger.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/assets/animations.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/assets/cache.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/assets/images.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/assets/text.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/assets/tilemap.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/basics/camera.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/basics/input.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/basics/shapes.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/helpers/_tilemapEditor.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/helpers/_tilemap_files.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/helpers/utils.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/physics/KinematicPlatform.py +0 -0
- {devpace-1.0.0/src/devPace → devpace-1.1.0/src/devpace}/physics/StateManager.py +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/tests/assets/PL #3 Species(Grass & flowers).png +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/tests/assets/TileSet/PL #1 TileSet(Ground).png +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/tests/assets/TileSet/PL #1 TileSet(Lava Animation).png +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/tests/assets/TileSet/PL #1 TileSet(Water Animation).png +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/tests/assets/levelTiles.png +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/tests/assets/test.png +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/tests/game.json +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/tests/platformergame.py +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/tests/props.json +0 -0
- {devpace-1.0.0 → devpace-1.1.0}/tests/test.json +0 -0
|
Binary file
|
devpace-1.1.0/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.0"
|
|
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
|
]
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
|
@@ -127,6 +127,10 @@ class Engine:
|
|
|
127
127
|
CollisionRect(self.screen_dim[0], 0, 5, self.screen_dim[1], ALL_COLLISION_LAYERS)
|
|
128
128
|
CollisionRect(0, self.screen_dim[1], self.screen_dim[0], 5, ALL_COLLISION_LAYERS)
|
|
129
129
|
|
|
130
|
+
def remove_obj(self, obj):
|
|
131
|
+
if obj.layer in Global.objects:
|
|
132
|
+
Global.objects[obj.layer].remove(obj)
|
|
133
|
+
|
|
130
134
|
def _func_get_global_(self) -> _global_:
|
|
131
135
|
print("<Engine> Global accsesed")
|
|
132
136
|
return Global
|
|
@@ -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
|
|
@@ -23,6 +23,7 @@ class DynamicBody:
|
|
|
23
23
|
self.image = None
|
|
24
24
|
self.animation = None
|
|
25
25
|
self.animationManager = None
|
|
26
|
+
self.area2D = None
|
|
26
27
|
|
|
27
28
|
#collision checks
|
|
28
29
|
self.smartCollisions = smartCollisions
|
|
@@ -132,4 +133,7 @@ class DynamicBody:
|
|
|
132
133
|
if self.animationManager is not None:
|
|
133
134
|
self.animationManager.x = self.x
|
|
134
135
|
self.animationManager.y = self.y
|
|
136
|
+
if self.area2D is not None:
|
|
137
|
+
self.area2D.x = self.x
|
|
138
|
+
self.area2D.y = self.y
|
|
135
139
|
|
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
|
|
File without changes
|