PixelPAD 2D - sprites

new_sprite(name: str[, rows: int, cols: int]) -> sprite

Example
Description
Loads a sprite asset.
Parameters
name
The name of a sprite to load, as a string.

rows
If the sprite asset is a sprite sheet, the number of rows in the sprite sheet. Default: 1

cols
If the sprite asset is a sprite sheet, the number of columns in the sprite sheet. Default: 1

Return
A sprite, which can be assigned to an object.

Sprites

Sprites are pictures. In PixelPAD, every object has a sprite assigned to it that says how the object looks in the game. A sprite is ultimately just an image file uploaded from your computer. You can add one by using the green plus sign (+) on the ASSETS sidebar. To load a sprite from within a script, use the new_sprite function.

Every GameObject class contains a variable called “sprite”. All we have to do is set the variable to the image you want and the PixelPAD2D game engine handles it from there. Check out the method new_sprite as it gives essential examples.
Company
Resources
Contact Us