Sprite:spriteToLocal

From GiderosMobile
Revision as of 15:31, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")

Available since: Gideros 2023.2
Class: Sprite

Description

Converts from one Sprite local space to another. <syntaxhighlight lang="lua"> Sprite:spriteToLocal(spr,x,y,z,tx,ty,tz) </source>

Parameters

spr: (Sprite) target sprite local space
x: (number) original x local space
y: (number) original y local space
z: (number) original z local space
tx: (number) the new x local space
ty: (number) the new y local space
tz: (number) the new z local space

Exemple

I am not sure this is a good example :-( <syntaxhighlight lang="lua"> -- event mouse enter example? local mypixel = Pixel.new(0xFF0000, 1, 64, 64) mypixel:setPosition(128, 128) stage:addChild(mypixel) mypixel:addEventListener(Event.MOUSE_ENTER, function(e) print("MOUSE_ENTER", e.x, e.y) print("MOUSE_ENTER mypixel:spriteToLocal", mypixel:spriteToLocal(stage, e.x, e.y, 0, mypixel:getPosition())) e:stopPropagation() end) </source>