Pyxel-Physics
Physics engine that merges Pyxel with Pymunk.
Installation
Clone repository and use flit install -s to install locally or pip install pyxel-physics, if you do not want to participate in the development of Pyxel Physics.
Tutorial
The folllowing code simulates a gas of spheres. Let us start importing some modules.
from random import uniform
import pyxel
import phys
First, we initialize pyxel and set the gravity in the space object.
pyxel.init(120, 80, fps=60)
space = phys.space(gravity=(0, 25))
Secondly, let us create some object in the screen. phys.circ produces a Circle body using an API similar to pyxel. Pyxel physics also has functions such as rect, tri, line and poly that behaves similarly.
radius = 2
for _ in range(50):
x, y = uniform(0, 120), uniform(0, 80)
phys.circ(x, y, radius, vel=(uniform(-25, 25), uniform(-25, 25)))
phys.margin(col=pyxel.COLOR_RED)
We can start the main loop using the default pyxel mechanisms, or simply executing the run() method of space objects.
space.run()
Metadata
Release files for pyxel-physics 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyxel-physics-0.1.0.tar.gz | 5.9 kB | Without provenance | Details for pyxel-physics-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyxel_physics-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for pyxel_physics-0.1.0-py2.py3-none-any.whl |
Total release size: 13.1 kB
Release files / pyxel-physics-0.1.0.tar.gz
| Download URL | pyxel-physics-0.1.0.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44a50b31f11f99c03323364b679438fbd2d758195a193e597091fa0a11af289a
|
|
BLAKE2b-256 checksum How to use checksums |
5fb091a6fa5de00555c3c959d55c016d14dc35c7757c6dd338dc60a1670c1375
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.24.0
|
Release files / pyxel_physics-0.1.0-py2.py3-none-any.whl
| Download URL | pyxel_physics-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1d38e1d3d0e71a393afb46356d4cbe665fca62f8d3c8cc8b368c6bbbf4d3c3ca
|
|
BLAKE2b-256 checksum How to use checksums |
33e8bfbd7d616396647e1893725b0afb552d33b42c689816458ec58b1ddee7ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.24.0
|
Security for pyxel-physics 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.