Creating a Countdown

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
slwatkins21
Posts: 3
Joined: Thu Mar 12, 2015 7:27 am

Creating a Countdown

Post by slwatkins21 » Thu Mar 12, 2015 8:25 am

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

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Creating a Countdown

Post by Klaus » Thu Mar 12, 2015 1:48 pm

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

slwatkins21
Posts: 3
Joined: Thu Mar 12, 2015 7:27 am

Re: Creating a Countdown

Post by slwatkins21 » Thu Mar 12, 2015 5:11 pm

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.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Creating a Countdown

Post by Klaus » Thu Mar 12, 2015 5:17 pm

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

Post Reply