A script to create "sprites" using the _draw()
function to easily create patterns, change the color palette, or change the pixel size.
The variables
_sprite
and_colors
are created using Aseprite to Godot variables.
Name | Type | Default |
---|---|---|
sprite | Array |
_sprite |
colors | PoolColorArray |
_colors |
repeat | Vector2 |
Vector2.ONE |
pixel_size | int |
1 |
offset | Vector2 |
Vector2.ZERO |
export(Array, Array, int) var sprite = _sprite setget _set_sprite
A 2D array with the indices of the colors array.
It can have null
values (those will be completely transparent pixels).
Name | Type | Default | Setter |
---|---|---|---|
sprite |
Array |
_sprite |
_set_sprite |
Example:
var _sprite = [
[0,0,0,0,0,0,0,1,1,0,0,],
[0,0,0,0,1,1,0,1,1,1,0,],
[0,0,1,0,1,1,0,1,1,1,0,],
[0,1,1,0,0,1,0,0,0,0,0,],
[1,1,1,1,0,0,0,0,0,0,0,],
[0,1,1,1,0,0,0,1,1,0,0,],
[0,0,1,0,0,1,1,1,1,0,0,],
[0,1,1,1,1,1,1,0,0,1,1,],
[1,1,1,1,1,1,1,0,1,1,1,],
]
export(PoolColorArray) var colors = _colors setget _set_colors
The colors of the sprite.
Name | Type | Default | Setter |
---|---|---|---|
colors |
PoolColorArray |
_colors |
_set_colors |
Example:
var _colors = PoolColorArray([
Color(1.0,0.63,0.0,1.0),
Color(0.67,0.32,0.21,1.0),
])
export(Vector2) var repeat = Vector2.ONE setget _set_repeat
The amount of times each sprite is repeated on the X and Y axis.
Useful to create a pattern.
Name | Type | Default | Setter |
---|---|---|---|
repeat |
Vector2 |
Vector2.ONE |
_set_repeat |
export(int) var pixel_size = 1 setget _set_pixel_size
A multiplier to increase the size of the sprite.
Name | Type | Default | Setter |
---|---|---|---|
pixel_size |
int |
1 |
_set_pixel_size |
export(Vector2) var offset = Vector2.ZERO setget _set_offset
The amount of extra pixels of the sprite from its original position.
Name | Type | Default | Setter |
---|---|---|---|
offset |
Vector2 |
Vector2.ZERO |
_set_offset |
See CHANGELOG.
- hiulit
Feel free to:
- Open an issue if you find a bug.
- Create a pull request if you have a new cool feature to add to the project.
If you find this project helpful, please consider supporting it through any size donations to help make it better.
If you can't, consider sharing it with the world...
... or giving it a star.
Thank you very much!
- Source code: MIT License.
- Documentation (GDScriptify): MIT License.
Powered by GDScriptify.