Login to PixelPAD
Save your project by logging in or signing up.
USERNAME OR EMAIL ADDRESS
PASSWORD
Forgot my Password?
Don't have an account?
Sign Up For PixelPAD
Save your project by logging in or signing up.
EMAIL ADDRESS
PASSWORD
CONFIRM PASSWORD
I already have an account
Sign up as a Teacher
Create classrooms, and monitor your students.
SCHOOL NAME
EMAIL ADDRESS
PASSWORD
CONFIRM PASSWORD
I already have an account
  • 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
Arm Build 2.8.4
Resources
Documentation
Discord
EULA
Privacy Policy
Contact Us
hello@pixelpad.io
© 2023 All Rights Reserved. PixelPAD.io
Region: us-west-1