How do you make something appear then disappear when tapped

okay so the full story is that i want these objects to pop up for about 3 seconds, if they touch it they gets 10 points if they don’t it just goes away and they don’t get any points. Is anyone able to help me with this?

let me know if you need more information. [import]uid: 162570 topic_id: 31021 reply_id: 331021[/import]

Take a look at the documentation for transition.to()

http://docs.coronalabs.com/api/library/transition/to.html

You could fade an object into view and then after a specific number of seconds fade it back out. You’ll use two calls to transition.to() to accomplish that. Be sure to look in the docs for the onComplete parameter because you’ll use that in the first transition.to which fades the object in, that then calls the second transition.to which fades the object out.

Jay [import]uid: 9440 topic_id: 31021 reply_id: 124033[/import]

Not quite what i was looking for but that could help me in certain parts but since its fast paced i need it to appear and disappear if possible. [import]uid: 162570 topic_id: 31021 reply_id: 124301[/import]

@zacchief118 ,

You want to simply set your ObjectToBeTouched.isVisible = false.

It’s instant and the object no longer receives a touch event, it’s just gone for now.

Then when it’s invisible, declare Object.x = number , Object.y = number moving it to a new location, could be a random number and time it to .isVisible = true, add sound, scale up on touch and …well, it’s a game!

Hope this helps,

Nail

[import]uid: 106779 topic_id: 31021 reply_id: 124323[/import]

Exactly what i needed, thank you. [import]uid: 162570 topic_id: 31021 reply_id: 124325[/import]

Take a look at the documentation for transition.to()

http://docs.coronalabs.com/api/library/transition/to.html

You could fade an object into view and then after a specific number of seconds fade it back out. You’ll use two calls to transition.to() to accomplish that. Be sure to look in the docs for the onComplete parameter because you’ll use that in the first transition.to which fades the object in, that then calls the second transition.to which fades the object out.

Jay [import]uid: 9440 topic_id: 31021 reply_id: 124033[/import]

Not quite what i was looking for but that could help me in certain parts but since its fast paced i need it to appear and disappear if possible. [import]uid: 162570 topic_id: 31021 reply_id: 124301[/import]

@zacchief118 ,

You want to simply set your ObjectToBeTouched.isVisible = false.

It’s instant and the object no longer receives a touch event, it’s just gone for now.

Then when it’s invisible, declare Object.x = number , Object.y = number moving it to a new location, could be a random number and time it to .isVisible = true, add sound, scale up on touch and …well, it’s a game!

Hope this helps,

Nail

[import]uid: 106779 topic_id: 31021 reply_id: 124323[/import]

Exactly what i needed, thank you. [import]uid: 162570 topic_id: 31021 reply_id: 124325[/import]