diff --git a/.docs/classes/NobleSprite.html b/.docs/classes/NobleSprite.html index ab54f0b..d528b55 100644 --- a/.docs/classes/NobleSprite.html +++ b/.docs/classes/NobleSprite.html @@ -30,6 +30,7 @@
NobleSprite() (see usage examples).
+ Do not call an "init" method directly. Use NobleSprite() (see usage examples).
+
+ NOTE: When __view is the path to an image file, or a Graphics.image object, the sprite's size is set automatically via setImage(). When __view is the path to a spritesheet/imagetable file, or a Noble.Animation object, the sprite's size is not set automatically. You must call setSize(width, height) with the dimensions of a single animation frame, or the sprite will never be drawn.
-- Provide a spritesheet image file to create a new Noble.Animation for a NobleSprite's view. -myNobleSprite = NobleSprite("path/to/spritesheet", true)+
-- Provide an image file to create a new Graphics.image for a NobleSprite's view.
myNobleSprite = NobleSprite("path/to/image")
-- Use an existing Noble.Animation for a NobleSprite's view. local myAnimation = Noble.Animation.new("path/to/spritesheet") myAnimation:addState("default", 1, animation.imageTable:getLength(), nil, true) -myNobleSprite = NobleSprite(myAnimation)+myNobleSprite = NobleSprite(myAnimation) +myNobleSprite:setSize(32, 32) -- The dimensions of a single frame.
-- Use an existing Graphics.image object for a NobleSprite's view.
local myImage = Graphics.image.new("path/to/image")
myNobleSprite = NobleSprite(myImage)
@@ -170,12 +177,35 @@ This method is the sprite's draw callback (see playdate.graphics.sprite:draw() in the Playdate SDK), which is invoked by Graphics.sprite.update() whenever this sprite is marked dirty. It runs in sprite-local coordinates, where (0, 0) is the top-left corner of the sprite's bounds, so calling it manually will not draw this sprite at its position in the scene.
To draw an animation directly to the screen without adding a sprite to the scene ("immediate mode"), use myNobleSprite.animation:draw(x, y) instead. To place an animated NobleSprite in a scene, use setSize() and add(x, y).
+
+
+
+
+
NOTE: When using a Noble.Animation as the view for a NobleSprite, the sprite's size is not set automatically; call the sprite's setSize() method with the dimensions of a single animation frame.