top of page

Sprite (PE.sprite)

PE.sprite.Image

class usage:

this is more organized and user friendly version of pygame.sprite.Sprite() object. can be used for one image sprites.

Image.__init__(self, img: pygame.Surface, pos=(0, 0), size=(10, 10), rot=0)

function actions:

initializing the class 

​

parameters:

img - the image texture of the sprite (pygame.Surface)

pos - sprite initial position (vector2 like)

size - sprite size (vector2 like)

rot - sprite initial rotation (vector2 like)

Image.update(self)

included in show_all() function

​

function actions:

put the class data on the pygame sprite.

​

recommended place in script:

before showing sprites, at the main loop

Image.sprite

variable usage:

this is a regular pygame sprite that contains all the class data.

PE.sprite.Animated

class usage:

this is more organized and user friendly version of pygame.sprite.Sprite() object combined with PE.gifsPG.Gif() object. can be used for animated sprites.

​

Animated.__init__(self, animation: gifsPG.Gif, pos=(0, 0), size=(10, 10), rot=0)

function actions:

initializing the class 

​

parameters:

animation - the gif texture of the sprite (pe.gifsPG.Gif)

pos - sprite initial position (vector2 like)

size - sprite size (vector2 like)

rot - sprite initial rotation (vector2 like)

Animated.update(self)

included in the show_all() function

​

function actions:

put the class data on the pygame sprite.

​

recommended place in script:

before showing sprites, at the main loop

PE.sprite.show_all(workspace: pygame.Surface)

function actions:

put every PE.sprites sprites on a surface

​

parameters:

workspace - the surface to put the sprites on (pygame.Surface)

​

recommended place in script:

at the main loop, between the screen filling and the screen update.

PE.sprite.init(screen_size_)

automated function, updates global data

​

function actions:

update render resolution

​

function usage:

used by PE.init() function to update render resolution for gifs.

​

parameters:

screen_size_ - new render resolution

PE.sprite.all_sprites

variable usage:

used by show_all() function. contains every PE sprite objects.

PE.sprite.sprites

variable usage:

used by show_all() function. contains every PE sprite object's pygame sprite objects.

Powered and secured by Wix © 2035

bottom of page