Pixel-Composer/scripts/sprite_add_functions/sprite_add_functions.gml

20 lines
421 B
Plaintext
Raw Normal View History

globalvar SPRITE_PATH_MAP;
SPRITE_PATH_MAP = {};
function sprite_add_map(path) {
var _s = sprite_add(path, 1, 0, 0, 0, 0);
SPRITE_PATH_MAP[$ path] = _s;
return _s;
}
2023-09-22 17:01:56 +02:00
function sprite_add_center(path) {
2023-12-08 03:50:09 +01:00
if(!file_exists_empty(path)) return noone;
2023-09-22 17:01:56 +02:00
var _s = sprite_add(path, 0, 0, 0, 0, 0);
var _sw = sprite_get_width(_s);
var _sh = sprite_get_height(_s);
sprite_set_offset(_s, _sw / 2, _sh / 2);
return _s;
}