Page 1 of 1

Creating a Countdown

Posted: Thu Mar 12, 2015 8:25 am
by slwatkins21
I was wondering how to code in a countdown timer (invisible if possible) to have an object drop along a created line made invisible after the timer hits zero. This would be a 15 second countdown.

The object in question is an image of a balloon. I'm trying to make it move in intervals connected to a count down timer.
This is the code that I have already for the image:

Code: Select all

on mouseUp
   move image "hot air balloon 1.png" to the points of graphic "line" in 2 seconds without waiting
end mouseUp

Re: Creating a Countdown

Posted: Thu Mar 12, 2015 1:48 pm
by Klaus
Hi slwatkins21,

1. welcome to the forum! :D

2. There are MANY ways to solve your probem in LC.
Like is one, add this to your script:

Code: Select all

on mouseUp
   move image "hot air balloon 1.png" to the points of graphic "line" in 2 seconds without waiting
  
  # We simply execute a handler which will hide the image with a 15 seconds delay!
  send "hide_the_image" to me in 15 secs
end mouseUp

command hide_the_image
    hide img "hot air balloon 1.png"
end hide_the_image
3. Here some great learnig resources for the basics of LC:
http://www.hyperactivesw.com/revscriptc ... ences.html

Best

Klaus

Re: Creating a Countdown

Posted: Thu Mar 12, 2015 5:11 pm
by slwatkins21
Thank you! That will be useful in the future!
However, I was looking for an invisible countdown, not to make the object invisible. Pretty much have the balloon drop after a 15 sec delay.

Re: Creating a Countdown

Posted: Thu Mar 12, 2015 5:17 pm
by Klaus
Ah, OK, then do something like this:

Code: Select all

on mouseUp
   move image "hot air balloon 1.png" to the points of graphic "line" in 2 seconds without waiting
  
  # We simply execute a handler which will hide the image with a 15 seconds delay!
  send "do_whatever_slwatkins21_wants_to" to me in 15 secs
end mouseUp

command do_whatever_slwatkins21_wants_to
    ## Do whatever you want to :-D
    ## Drop a ballon, plant a tree, tease a cat, read a good book...
end do_whatever_slwatkins21_wants_to
Same principle, you get the picture :D