This site requires JavaScript, please enable it in your browser!
Greenfoot back
ked0030
ked0030 wrote ...

2012/10/26

Disappear and Reappear

ked0030 ked0030

2012/10/26

#
I have a project that I have to do for a class and I was wondering if there was a way to make a duck disappear or reappear after a couple of seconds.
danpost danpost

2012/10/26

#
There are at least two ways to do that. (1) save location and a reference to the object; then, remove, wait, and replace. (2) set the transparency of the image of the object to zero, wait, then change it back to 255 The 'wait'ing part should be done with a timer (not a loop), in the class of the object that is hiding. Save the current time in a class field when you make the object disappear and have the act check to see if the timer is not zero; if not, compare difference between the saved time and current time to see if time has elapsed; when elapsed, make the object re-appear and set the timer variable to zero. Declare the timer variable equal to zero.
ked0030 ked0030

2012/10/26

#
Thank you!
You need to login to post a reply.