Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Boolean. to stop other transitions from working
Started by dwane dibbley Jan 31 2019 02:21 AM

2 replies to this topic
boolean movement transitions
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

dwane dibbley

[GLOBAL: userInfoPane.html]
dwane dibbley
  • Observer

  • 6 posts
  • Corona SDK

freeToMove = true

local check = function(freeToMove)
    freeToMove = true
end 

local Movement = function() 
    if freeToMove then
        freeToMove = false
        transition.to( man, { time=speed, x=(l[c].x), onComplete=check(freeToMove)  } )
    end
end

Trying to make a boolean that will stop other transitions from working, whilst one is in the process of moving.

this transition will only work once...



[TOPIC: post.html]
#2

ldurniat

[GLOBAL: userInfoPane.html]
ldurniat
  • Contributor

  • 389 posts
  • Corona SDK

Hi @iansingleton39,

 

1. You use two different variables with the same name 'freeToMove' One is global and second is local (in check function).

2. Wrong argument in transition. For onComplete parameter you need to provide function name but instead that you call function.

 

Try

freeToMove = true 

local check = function() 

     freeToMove = true 

end 

local Movement = function() 
   
     if freeToMove then 
         
         freeToMove = false 
         transition.to( man, { time=speed, x=(l[c].x), onComplete=check } ) 

     end 

end

Read more:

 

 

Have a nice day:)

 

ldurniat



[TOPIC: post.html]
#3

dwane dibbley

[GLOBAL: userInfoPane.html]
dwane dibbley
  • Observer

  • 6 posts
  • Corona SDK

Thanks for you time and help... I can now learn from this and move on to my next battle.


[topic_controls]
[/topic_controls]