• DOCS
  • EXPLORE
  • LEARN
  • LIBRARY
  • LOGIN
  • Introduction
  • Game
  • Start-loop
  • Objects
  • Sprites
  • Animation
  • Sounds
  • Rooms
  • Input
  • Collision
  • Functions
  • Camera
  • Fps
  • Text
  • Filters
  • Multiplayer
  • Legacy

PixelPAD 2D - sprites

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.

get_bounds(obj: gameobject) -> dict

Example
Description
Get the bounds of an object. Bounds uses the sprite assigned to the object and considers the angle, scale, x and y position of the object
Parameters
obj
The game object to check the bounds for

Return
Returns a dictionary with keys: topLeft, topRight, bottomLeft, bottomRight with its corresponding values.

get_width(obj: gameobject) -> int || get_height(obj: gameobject) -> int

Example
Description
gets the width or height of an object with a sprite assigned. This will consider scaleX and scaleY but does not consider the angle of the object.
Parameters
obj
The game object to check the bounds for

Return
get_width() returns the width of the object in pixels. get_height() returns the height of the object in pixels.

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.
PixelPAD
About Us
Discord
Arm Build 3.0.478
Resources
Documentation
EULA
Privacy Policy
Contact Us
hello@pixelpad.io
© 2026 All Rights Reserved.
PixelPAD.io
Logo

Welcome Back!

Log in to continue creating

Save your project by logging in or signing up.
Forgot Password?

Don't have an account?

Logo

Create Your Account

Join thousands of creators on PixelPad

Save your project by logging in or signing up.

Already have an account? Log in

Logo

Join as an Educator

Empower your students with creative tools

Create classrooms and monitor your students' progress.

Already have an account? Log in