Tag Info

New answers tagged


You could look at Skulpt.org which provides a completely brower-based implementation of PyGame. However I do not know what external APIs PyGame uses and which are supported by Skulpt. Edit: it seems Skulpt also has WebGL bindings so this should be very possible!


If you really, truly, absolutely want access a sprite by index, you can do this: third_sprite = mygroup.sprites()[2] So your function would be: def getSpriteByPosition(position,group): return group.sprites()[position] Which throws IndexError if the index is not found. If you want to return None in that case, simply enclose the line with a try ...


Move along X axis only, test for colision, if true invert X movement. Repeat for Y.


The problem is in your pygame usage: you're re-creating the circle on every frame. Pygame works best if you create every image only once, on its own Surface (think of it as a virtual canvas), and then in each frame you blit that surface's image onto the screen (which is also a surface). Think of blit as an ultra-fast copy from surface to surface. Here's an ...

Top 50 recent answers are included