hello,
i have a problem to make a transition in two parts with the event.x. my transition work ( all my characters are basics shapes if you want test my code) but my character jump to his initial position at the end and i don’t know how i can cancel this.
thanks for your help.
local background=display.newRect( 0,200,4000,4000 ) local xbegin = 0 local ybegin = 200 local character = display.newCircle( 0,0,25 ) local paint = {0, 0, 0} character.fill=paint character.yScale = 1 character.xScale = 1 character.x = xbegin character.y = ybegin local function myTapListener(event) local xend = event.x local yend = event.y if (xend == xbegin) then xmiddle = xend else xmiddle = (xend-xbegin)\*0.5+xbegin end if (yend == ybegin) then local ymiddle = yend else ymiddle = (yend-ybegin)\*0.5+ybegin end local function spawn() character = display.newCircle( 0,0,25 ) paint = {0, 0, 0} character.fill=paint character.x = xmiddle character.y = ymiddle character.yScale = 0.5 character.xScale = 0.5 end local function removal1(character) character:removeSelf() spawn() end local transitionspecial = transition.to( character, { time=500, x=xmiddle, y=ymiddle, yScale=2, xScale=2, onComplete=removal1, transition=easing.inBounce }) local transitionspecial2= transition.to( character, { time=550, x=xend, y=yend, yScale=0.5, xScale=0.5, transition=easing.outElastic, onComplete= function(obj) character.x = obj.x character.y = obj.y end }) end background:addEventListener("tap", myTapListener )