I know, I couldn’t find anything other than drawing images or filling rects, so I did what anyone else would do. I used images of short lines and drew as many as I needed to create a rect.
I wanted to draw some lines and mistakenly thought I could use the filled rectangle function.
I always assumed that just drawing lines would be “better” in terms of “performance” than having to store and draw a whole bitmap of which most pixels are transparent. I currently don’t really need the lines though.
Particles, particles everywhere.
And lasers light beams.
Also debug hit box, 3d flat shaded triangles, landscapes.
If you are not a pixel artist primitives help a lot.
I usually use primitives for drawing UI elements.
Boxes to draw text on come in very handy.
(Fill a rect in a background colour, draw an outline of a foreground colour,
put text in the resulting empty space.)
Also shape drawing is dynamically scalable, bitmaps aren’t (unless you repeat part of the image).
And shapes are good placeholders for when you can’t be bothered to do art.
Just use a splash screen to seed your random numbers:
def splashScreen():
while True:
random.getrandbits(30)
eventtype = upygame.event.poll()
if eventtype != upygame.NOEVENT and eventtype.type == upygame.KEYUP:
return
screen.blit( splash.bmp, 0, 0 )
upygame.display.flip()
This calls random.getrandbits every frame, until the player presses a button. Since the amount of time until that happens isn’t constant, you get a different sequence of random numbers from then on.