Some content could not load. We could not load files from our content delivery networks (CDN).
Your network may be blocking access. Ask your IT to allow loading from: .
Network domains required
We use these CDNs to deliver the files the site needs to run, please allow the following:
Domains to allow Used for
cdn.jsdelivr.net styles and JavaScript libraries.
cdnjs.cloudflare.com JavaScript libraries and icons.
code.jquery.com jQuery and jQuery UI.
pixelpad.io, cdn.pixelpad.io CDN of images, sounds, and application files.
cdn.datatables.net Interactive tables.
fonts.googleapis.com, fonts.gstatic.com Fonts stylesheets and font files.
s3.us-west-1.amazonaws.com, s3-us-west-1.amazonaws.com Project files stored on Amazon S3.
vmwan2cvlyzeklq4knz63qh6d40lewka.lambda-url.us-west-1.on.aws Amazon AWS Project play counters.
nexushud.org Learning assistant.
u45ivsqoja6u3sk7zaliv37zq40hpbxk.lambda-url.us-west-1.on.aws Amazon AWS AI character responses, when used.
  • 探索
  • 學習
  • 登入
  • Introduction
  • Game
  • Start-loop
  • Objects
  • Sprites
  • Animation
  • Sounds
  • Rooms
  • Input
  • Collision
  • Functions
  • Camera
  • Fps
  • Text
  • Graphics
  • Filters
  • Multiplayer
  • Ai

PixelPAD 2D - sprites

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

範例
說明
Loads a sprite asset.
參數
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

回傳值
A sprite, which can be assigned to an object.

get_bounds(obj: gameobject) -> dict

範例
說明
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
參數
obj
The object to check the bounds for

回傳值
Returns a dictionary with keys: topLeft, topRight, bottomLeft, bottomRight with its corresponding values.

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

範例
說明
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.
參數
obj
The object to check the bounds for

回傳值
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 project. 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 engine handles it from there. Check out the method new_sprite as it gives essential examples.
PixelPAD
關於我們
Discord
Arm 版本 3.0.943
資源
文件
EULA
隱私權政策
聯絡我們
hello@pixelpad.io
© 2026 版權所有。
PixelPAD.io
繁體中文
English Deutsch Español Français Português 日本語 简体中文 繁體中文 한국어
Logo

歡迎回來!

登入後繼續創作

登入或註冊即可儲存你的專案。
忘記密碼?

還沒有帳號?

Logo

建立你的帳號

加入 PixelPad 上成千上萬的創作者

登入或註冊即可儲存你的專案。

已經有帳號了? 登入

Logo

以教育者身分加入

用創意工具,讓你的學生大展身手

建立班級並追蹤學生的學習進度。

已經有帳號了? 登入