Skip to content

Commit

Permalink
Doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinShadewing committed Jul 19, 2024
1 parent c4f9fb8 commit c1a2e35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/en/graphics.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

* <a name="getDrawTarget"></a>**`getDrawTarget()`**

Returns the ID of the current texture being drawn to; 0 if drawing directly to the screen.
Returns the ID of the current texture being drawn to; 0 if drawing directly to the screen. Images created with `loadImage` or `newTexture` are valid drawing targets. Mixing them with [`newSpriteFT`](sprites.md#newSpriteFT) will allow you to create sprites you can edit in runtime.

* <a name="drawImage"></a>**`drawImage( image, x, y )`**

Expand Down
6 changes: 4 additions & 2 deletions docs/en/sprites.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@

&nbsp;

* <a name="newSprite"></a>**`newSprite( file, width, height, margin, padding, pivotX, pivotY )`**
* <a name="newSprite"></a>**`newSprite( file, width = 0, height = 0, pivotX = 0, pivotY = 0, margin = 0, padding = 0 )`**

Creates a new sprite from a grid of frames in an image file. The filename for a sprite is stored internally for use with [Tiled](https://mapeditor.org) maps.

* <a name="newSpriteFT"></a>**`newSpriteFT( texture, width, height, margin, padding, pivotX, pivotY )`**
* <a name="newSpriteFT"></a>**`newSpriteFT( texture, width = 0, height = 0, pivotX = 0, pivotY = 0, margin = 0, padding = 0 )`**

Creates a new sprite, but instead of loading an image file, it uses a previously created texture. This allows you to make sprites you can draw on and edit.

`margin` is the distance between the frames and edges of the image, and `padding` is the space between frames. If [`setScalingFilter()`](graphics.md#setScalingFilter) has been set to true, a margin and padding of at least 1 should be used to prevent frame bleeding.

`pivotX` and `pivotY` are the points around which the sprite is rotated and offsets where it will appear when drawn. Margin and padding are not taken into account with these it only applies to the frame itself.

If `width` and/or `height` are left at zero, then the entire respective width or height will be used. This is useful for when you want to use an entire image as a single frame and still have certain sprite-related functions available.

* <a name="drawSprite"></a>**`drawSprite( sprite, frame, x, y, angle = 0, flip = 0, xscale = 1.0, yscale = 1.0, alpha = 1.0, color = 0xffffffff )`**

Draws a given frame of a sprite to `x`,`y`. If a value above the sprite's maximum frame number or below zero is given, then the value will wrap around. Sprites can also be transformed and blended with the given `alpha` value. `alpha` should be a float between `0.0` and `1.0`. You can also use `color` to modulate the texture (think Game Maker's color blending).
Expand Down

0 comments on commit c1a2e35

Please sign in to comment.