https://github.com/gediminasz/pyxel-extensions
A collection of helpers for developing games with Pyxel
https://github.com/gediminasz/pyxel-extensions
gamedev python pyxel
Last synced: 6 months ago
JSON representation
A collection of helpers for developing games with Pyxel
- Host: GitHub
- URL: https://github.com/gediminasz/pyxel-extensions
- Owner: gediminasz
- Created: 2018-11-03T16:03:31.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-12T19:57:48.000Z (almost 7 years ago)
- Last Synced: 2025-02-15T01:28:43.611Z (8 months ago)
- Topics: gamedev, python, pyxel
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pyxel Extensions
A collection of helpers for building games with [Pyxel](https://github.com/kitao/pyxel). A framework, if you will.
## Installation
```
pipenv install -e git+https://github.com/gediminasz/pyxel-extensions.git@v0.0.2#egg=pyxel_extensions
```## Features
* Redux inspired store for game state
* Scenes
* Hot module reloading## Example
```py
import pyxelfrom pyxel_extensions import action
from pyxel_extensions.game import Game
from pyxel_extensions.scene import Sceneclass Example(Game):
def get_scenes(self):
return (ExampleScene,)class ExampleScene(Scene):
def update(self):
if pyxel.btnp(pyxel.KEY_SPACE):
self.store.dispatch(increment_counter())def draw(self):
pyxel.text(10, 10, 'Press to increment:', 7)
pyxel.text(10, 20, str(self.store.state['counter']), 7)@action
def increment_counter(state):
return {**state, 'counter': state['counter'] + 1}if __name__ == '__main__':
Example(
initial_state={'counter': 0},
initial_scene=ExampleScene
).run()
```## See Also
* https://github.com/gediminasz/games