Created
November 3, 2018 23:08
-
-
Save Sephi-Chan/f3feccd5341ffe6539fd77bb995d2fd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local sprite = app.activeSprite; | |
local data_layer = get_layer(sprite, "Data") | |
local cel = data_layer.cels[1] | |
local image = cel.image | |
local red_pixel = app.pixelColor.rgba(255, 0, 0) | |
local origin = nil | |
print("sprite.width " .. sprite.width) | |
print("sprite.height " .. sprite.height) | |
print("image.width " .. image.width) | |
print("image.height " .. image.height) | |
print("Looking for " .. red_pixel) | |
for y = 0, sprite.height - 1 do | |
for x = 0, sprite.width - 1 do | |
pixel = image:getPixel(x, y) | |
print(y .. " " .. x .. " " .. pixel) | |
if pixel == red_pixel then | |
origin = { x = x, y = y } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment