PyScene 1.0.6__tar.gz → 1.0.7__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.
- {pyscene-1.0.6 → pyscene-1.0.7}/PKG-INFO +2 -2
- {pyscene-1.0.6 → pyscene-1.0.7}/README.md +1 -1
- {pyscene-1.0.6 → pyscene-1.0.7}/pyproject.toml +1 -1
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/Game.py +1 -2
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/__init__.py +5 -1
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/objs/GameObj.py +2 -0
- pyscene-1.0.7/src/PyScene/objs/Timer.py +33 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/objs/__init__.py +2 -1
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/objs/animation.py +2 -2
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/utils/Assets.py +6 -2
- {pyscene-1.0.6 → pyscene-1.0.7}/.gitignore +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/LICENSE +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/Collisions.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/Keys.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/Math.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/Net.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/objs/Collision_shapes.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/objs/Shapes.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/objs/Text.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/utils/Subscreen.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/src/PyScene/utils/__init__.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/test.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/tests/flappy_bird.py +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/tests/pause.png +0 -0
- {pyscene-1.0.6 → pyscene-1.0.7}/tests/testColl.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: PyScene
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: A small example package
|
|
5
5
|
Project-URL: Homepage, https://github.com/sfertig/PyScene
|
|
6
6
|
Project-URL: Issues, https://github.com/sfertig/PyScene/issues
|
|
@@ -18,5 +18,5 @@ PyScene is a custom python + pygame framework / engine developed to streamline 2
|
|
|
18
18
|
|
|
19
19
|
Please Note: This engine is still in development and many features, like tilemaps and audio, are a work in progress. It also lack any form of documentation, I ask for patience as docs will be rolled out once the core features are more solidified.
|
|
20
20
|
|
|
21
|
-
PyScene is in developement and API's may change offten, a fully stable version should come with v2.0.0, currently on v1.0.
|
|
21
|
+
PyScene is in developement and API's may change offten, a fully stable version should come with v2.0.0, currently on v1.0.7
|
|
22
22
|
|
|
@@ -4,5 +4,5 @@ PyScene is a custom python + pygame framework / engine developed to streamline 2
|
|
|
4
4
|
|
|
5
5
|
Please Note: This engine is still in development and many features, like tilemaps and audio, are a work in progress. It also lack any form of documentation, I ask for patience as docs will be rolled out once the core features are more solidified.
|
|
6
6
|
|
|
7
|
-
PyScene is in developement and API's may change offten, a fully stable version should come with v2.0.0, currently on v1.0.
|
|
7
|
+
PyScene is in developement and API's may change offten, a fully stable version should come with v2.0.0, currently on v1.0.7
|
|
8
8
|
|
|
@@ -96,7 +96,7 @@ class _game:
|
|
|
96
96
|
def __update(self):
|
|
97
97
|
self.click = False
|
|
98
98
|
self.dt = self.clock.tick(self.fps)/1000.0
|
|
99
|
-
self.events = pygame.event.get()
|
|
99
|
+
self.events = pygame.event.get().copy()
|
|
100
100
|
|
|
101
101
|
for obj in self.dynamic_col: obj.update()
|
|
102
102
|
|
|
@@ -189,7 +189,6 @@ class _game:
|
|
|
189
189
|
class Scene:
|
|
190
190
|
def __init__(self, name):
|
|
191
191
|
self.name = name
|
|
192
|
-
Game.scenes[name] = self
|
|
193
192
|
self._objects = []
|
|
194
193
|
self._render_queue = []
|
|
195
194
|
self.queue_creation = []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#imports
|
|
2
2
|
"PyScene is a custom python + pygame framework / engine developed to streamline 2d game development."
|
|
3
|
-
"Version: 1.0.
|
|
3
|
+
"Version: 1.0.7"
|
|
4
4
|
|
|
5
5
|
from .Game import Game, Scene, handle_collision
|
|
6
6
|
from .Math import *
|
|
@@ -26,6 +26,10 @@ __all__ = [
|
|
|
26
26
|
"Line",
|
|
27
27
|
"Text",
|
|
28
28
|
"Image",
|
|
29
|
+
"Timer",
|
|
30
|
+
|
|
31
|
+
"Animation",
|
|
32
|
+
"AnimationManager",
|
|
29
33
|
|
|
30
34
|
"StaticCollisionRect",
|
|
31
35
|
"DynamicCollisionRect",
|
|
@@ -15,6 +15,8 @@ class GameObj: #this will be the base class of every game obj
|
|
|
15
15
|
if not Global: Game._queue_add(self)
|
|
16
16
|
else: Game.queue_creation.append(self) #if obj is just global anyway
|
|
17
17
|
|
|
18
|
+
self._global = Global
|
|
19
|
+
|
|
18
20
|
def update(self): pass
|
|
19
21
|
def render(self): pass
|
|
20
22
|
def destroy(self): Game._queue_remove(self)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from .GameObj import GameObj
|
|
2
|
+
from ..Game import Game
|
|
3
|
+
from ..Math import Vector2D
|
|
4
|
+
|
|
5
|
+
class Timer(GameObj):
|
|
6
|
+
def __init__(self, duration, active=True, Global=False):
|
|
7
|
+
super().__init__(Vector2D(0, 0), 0, active, True, Global)
|
|
8
|
+
self.duration = duration
|
|
9
|
+
self.elapsed = 0.0
|
|
10
|
+
self.running = False
|
|
11
|
+
self.start()
|
|
12
|
+
|
|
13
|
+
def start(self):
|
|
14
|
+
self.elapsed = 0
|
|
15
|
+
self.running = True
|
|
16
|
+
|
|
17
|
+
def stop(self):
|
|
18
|
+
self.running = False
|
|
19
|
+
|
|
20
|
+
def get_time(self):
|
|
21
|
+
return self.elapsed
|
|
22
|
+
|
|
23
|
+
def update(self, dt):
|
|
24
|
+
if not self.active: return
|
|
25
|
+
if self.running:
|
|
26
|
+
self.elapsed += dt
|
|
27
|
+
if self.elapsed >= self.duration:
|
|
28
|
+
self.running = False
|
|
29
|
+
return True
|
|
30
|
+
return False
|
|
31
|
+
|
|
32
|
+
def is_done(self):
|
|
33
|
+
return not self.running and self.elapsed >= self.duration
|
|
@@ -3,5 +3,6 @@ from .Shapes import *
|
|
|
3
3
|
from .Text import *
|
|
4
4
|
from .animation import *
|
|
5
5
|
from .Collision_shapes import *
|
|
6
|
+
from .Timer import Timer
|
|
6
7
|
|
|
7
|
-
__all__ = ["GameObj", "Rect", "Circle", "Line", "Text", "Image", "Animation", "AnimationManager", "StaticCollisionRect", "DynamicCollisionRect"]
|
|
8
|
+
__all__ = ["GameObj", "Rect", "Circle", "Line", "Text", "Image", "Animation", "AnimationManager", "StaticCollisionRect", "DynamicCollisionRect", "Timer"]
|
|
@@ -63,7 +63,7 @@ class Animation(GameObj):
|
|
|
63
63
|
self.images[i] = pygame.transform.flip(self.images[i], True, False)
|
|
64
64
|
|
|
65
65
|
def copy(self):
|
|
66
|
-
return Animation(self.image, self.size, self.fps, self.loop)
|
|
66
|
+
return Animation(self.image, self.size, self.fps, self.loop, self.pos, self.z_index, self.active, self.visible, self.offset, self._global)
|
|
67
67
|
def render(self):
|
|
68
68
|
if not self.visible: return
|
|
69
69
|
Game.cam.draw_image(self.get_image(), self.pos, self.offset)
|
|
@@ -74,7 +74,7 @@ class AnimationManager(GameObj):
|
|
|
74
74
|
self.animations = animations
|
|
75
75
|
self.current_anim = current_anim
|
|
76
76
|
|
|
77
|
-
for anim in self.animations:
|
|
77
|
+
for anim in self.animations.values():
|
|
78
78
|
anim.destroy() #remove from global or scene calls
|
|
79
79
|
|
|
80
80
|
def new_anim(self, name, anim):
|
|
@@ -84,8 +84,12 @@ class _assets:
|
|
|
84
84
|
def new_font(self, name, path, size):
|
|
85
85
|
self.fonts[name] = pygame.font.Font(path, size)
|
|
86
86
|
|
|
87
|
-
def new_animation(self, name, image, size=16, fps=3, loop=True, pos=Vector2D(0, 0), z_index=0, active=True, visible=True, offset=True, Global=False):
|
|
88
|
-
|
|
87
|
+
def new_animation(self, name, image, size=16, fps=3, loop=True, rect=None, pos=Vector2D(0, 0), z_index=0, active=True, visible=True, offset=True, Global=False):
|
|
88
|
+
m = image
|
|
89
|
+
if rect is not None:
|
|
90
|
+
m = image.subsurface(rect)
|
|
91
|
+
self.animations[name] = Animation(m, size, fps, loop, pos, z_index, active, visible, offset, Global)
|
|
92
|
+
return self.animations[name]
|
|
89
93
|
def new_anim_nIMG(self, name, size=16, fps=3, path=None, rect=None, scale=1.0, colorKey=(0, 0, 0), sWidth=None, sHeight=None, loop=True, pos=Vector2D(0, 0), z_index=0, active=True, visible=True, offset=True, Global=False):
|
|
90
94
|
#create image
|
|
91
95
|
self.new_image(name, path, rect, scale, colorKey, sWidth, sHeight)
|
|
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
|