The attached module lets you a display an animated, Pseudo-3D Projection Starfield in your project. Usage is as easy as dropping it into your project's "game" folder and following the example below.
The math is cribbed from:
http://codentronix.com/2011/05/28/3d-st ... nd-pygame/
As such, this module is available under the MIT License.
Optional arguments are:
Perspective (float) : Default is 128.0. Changes the angle of the viewing frustum. Can be played with to adapt to your project's screen size.
Child (displayable): Defaults to a white Solid inside a Fixed. If provided, lets you use a displayable as the star.
Code: Select all
init:
define space = Solid((0, 0, 0, 255))
define stars = ProjectionStarfield(count=512,depth=16)
#Screen where the displayable is shown
screen starfield:
add space
add stars
# The game starts here.
label start:
show screen starfield
"Space."
hide screen starfield
"The final frontier."
return