is there a way to stop a scale animation ? because all I have coded for my game is based on this principle
local box = display.newRect(100,100,10,10) local text = display.newText("", 250,100,native.systemFontBold,30) local t = transition.scaleBy(box, {time = 10000, xScale=10, yScale=10}) local seconds = 1 local function killIt() print(box.xScale) seconds = seconds + 1 text.text = seconds if box.xScale \> 4 then transition.cancel( t ) end end timer.performWithDelay(1000, killIt, 0)
This worked for me. Perhaps you can compare and figure out what’s different.
Rob
yes it’s work i understand that wiht the print(box.scale)the function includes when to intervene
thanks and good night
hello sorry to bother you again …
I do not understand why my argument does not work … yet it is logical.
If time = 800 then you stopped the scalemin function but it does not work … you know tell me why?
thank you in advance
local box = display.newRect(100,100,20,20) local text = display.newText("", 250,100,native.systemFontBold,30) local t = transition.scaleBy(box, {time = 1000, xScale=10, yScale=10}) local move = transition.to(box, {time=3000, x=300, y=200}) local seconds = 1 local function scalemin() transition.scaleBy(box, {tag=scall, time = 1000, xScale=-0.5, yScale=-1}) end local function killIt() print(box.xScale) seconds = seconds + 1 text.text = seconds if box.xScale \> 4 then transition.cancel( t ) transition.cancel( move) scalemin() if time = 800 then transition.cancel(scalemin) end end end timer.performWithDelay(1000, killIt, 0)
even this should work and no??
if seconds \> 4 then transition.cancel( scall ) end
The tags are strings so should be surrounded by quotes. … tag = “scall” … transition.cancel(“scall”) … etc
Then it should work.
Edit: I mean it should work after doing your _ seconds > 4 _ modification and fixing the tags.
_ time = 4000 _ does not work. You have not defined variable _ time _ anywhere.
thank you …so sometimes we search…and it’s a stupid mistake
pfouuuu it’s hard… one hour on that …
now i don’t understand why it doesn’t work
when my grid is displayed perfectly on the screen
You can not compare the value of a grid?
local function comparesscale() print(grille[2][4].yScale) if grille[2][4].yScale \> -0.1 then display.newRect(100,100,100,100) end end
Nobody ?
You need to show more code. What is in those array cells?
this:
display.newRect(100,100,100,100)
creates a new rectangle, but it doesn’t store the reference to it, so you have no way of accessing it afterwards
hi, i have started a new topic where there is the full code :
http://forums.coronalabs.com/topic/49186-grid-problem-to-acces-a-value-of-a-cell/