We are making a 2D side scrolling game and an item in the game will be a torch. We have a player who's arm can rotate and we can take the arms angle. We are looking at having a triangular beam shape, following the angle of the arm. We have had a few ideas like have an alpha image over the whole screen and individually removing alpha from each pixel based on the arm angle, but we think this will be too intensive. Any ideas would be greatly appreciated. Thanks.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Changing pixels individually is really slow; it only works if you would use e.g.
numpy
to manipulate the image data, since then most work will be done in optimized, compiled C code and not in the python runtime.An easy way is to just use another
Surface
to do this manipulation using a different render mode, likeBLEND_RGBA_SUB
.Here's a minimal example:
circle.png:
screenshot: