Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

variables for all tansitions?
Started by dodi_games Apr 23 2019 03:15 PM

2 replies to this topic

Best Answer roaminggamer , 23 April 2019 - 08:25 PM

1. Your question is backwards by the way.  You don't assign variable to transitions.  You assign the return value of a transition.*() call to a variable.  For discussion sake, let's refer to the return value as a handle.

 

2. If you don't intend to do anything with the handle in the future, you do not need to assign it to a variable.  

 

3. You assign a handle to a variable so you can refer to it later and inspect the state of the transition and/or modify it in some way.  (I don't mean like change the length or anything.  I mean interact as in pause or cancel).

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

dodi_games

[GLOBAL: userInfoPane.html]
dodi_games
  • Contributor

  • 367 posts
  • Corona SDK

let's say I'm using transitions to mount some objects in my game. I wanted to ask if it is mandatory to assign variables to all transitions or can they be left without a variable?

 

Something like:

local t1, t2, t3

t1 = transition.fadeOut( ball, { time=300 } )

Or simply:

transition.fadeOut( ball, { time=300 } )

taking into account that the transition can go free or within a function or an anonymous function?

 

Or maybe I should use a table?

 

Thanks in advance

DoDi



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,544 posts
  • Corona SDK

  Best Answer

1. Your question is backwards by the way.  You don't assign variable to transitions.  You assign the return value of a transition.*() call to a variable.  For discussion sake, let's refer to the return value as a handle.

 

2. If you don't intend to do anything with the handle in the future, you do not need to assign it to a variable.  

 

3. You assign a handle to a variable so you can refer to it later and inspect the state of the transition and/or modify it in some way.  (I don't mean like change the length or anything.  I mean interact as in pause or cancel).



[TOPIC: post.html]
#3

dodi_games

[GLOBAL: userInfoPane.html]
dodi_games
  • Contributor

  • 367 posts
  • Corona SDK

Thanks! @roaminggamer


[topic_controls]
[/topic_controls]