How to make objects appear and disappear based on integer values

First post here!
I’m looking for help on how to make an object appear and disappear based on integer values.

I have 3 text images at the top, A, B, and C, when A is touched it changes integer value to 1, when B is touched, changes to 2, and C changes it to 3.

I want a first set of objects to appear when integer = 1, a second set to appear when integer = 2 and so on.

I’ve looked for tutorials on this, but not sure where to begin!

Thank you! [import]uid: 63661 topic_id: 11869 reply_id: 311869[/import]

You could make an object appear to dissapear by setting its alpha value to 0. You can make it appear by setting it back to 1.

Something like -

[code]
if integervalue==1 then
object.alpha=1
else
object.alpha=0
end

[code] [import]uid: 49987 topic_id: 11869 reply_id: 43252[/import]

  1. use CoronaUI to create buttons
  2. create groups for each image set
  3. write a function like this
  
local function checkABC ()  
  
 if integer == 1 then  
 group1.isVisible=true  
 group2.isVisible=false  
 group3.isVisible=false  
 elseif integer == 2 then  
 group1.isVisible=false  
 group2.isVisible=true  
 group3.isVisible=false  
 else  
 group1.isVisible=false  
 group2.isVisible=false  
 group3.isVisible=true  
 end  
  
end  
  

cheers
-finefin [import]uid: 69254 topic_id: 11869 reply_id: 43253[/import]

Thanks so much for the response! I’ll try these! :slight_smile:

-Jenny [import]uid: 63661 topic_id: 11869 reply_id: 43254[/import]

or use an array,

[lua]local threeObjects={}
local i

– declare and create the three objects

threeObjects[1]=object1
threeObjects[2]=object2
threeObjects[3]=object3
function toggleVisibility(thisObject)
for i=1,3 do
threeObjects[i].isVisible = false
end

threeObjects[thisObject].isVisible=true
end
toggleVisibility(1)[/lua]

hope you get the idea,

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 11869 reply_id: 43322[/import]

Grats on your first post :slight_smile:

You’ve come a long way in a short time!

Peach [import]uid: 52491 topic_id: 11869 reply_id: 43403[/import]

Wow these responses do look daunting, but I’ll keep trying :slight_smile:

Basically the items that appear and disappear based on integer values are also clickable, and each of them spawns themselves on screen when you click a certain area of the screen.

On top of that, I’d like drag and drop to be implemented… this is going to be fun! :stuck_out_tongue:

Thanks to your help Peach, I’m off to a good start!

:slight_smile: [import]uid: 63661 topic_id: 11869 reply_id: 43439[/import]