Jungle Jam Featured as one of the Top 50 Apps For Kids by Babble!

Babble - Top 50 Apps for Kids 2012We’re excited that Jungle Jam has been selected by Babble as on of the top 50 apps for Kids of 2012. We’re passionate about producing great apps for children and have been awestruck by the community response for Jungle Jam.
Posted in Uncategorized | Leave a comment

Child-Proof Button Coding Technique: Wait Three Seconds

I’ve been asked by a few developers about the code behind our child-proof buttons in Touch To Color Farm. We use Corona SDK and the Lua programming language for development but this technique can work in any language with a little tweaking.

How it works

  1. The user touches a button and a “Hold For 3 Seconds” message appears.
  2. If the user continues holding the button down for 3 seconds the action executes.
  3. If at any time the user releases the button or their finger slides off before 3 seconds have passed then the action is not executed.

The flow

  1. A button listener is added to my button image.
  2. When the button is pressed the “Hold For 3 Seconds” message appears on the screen and a timer listener is added that starts counting.
  3. If the timer hits three seconds then execute the action.
  4. If the button is released or the user’s finger slides off the timer listener is removed.

The code

 

By the way

  • The code listed above assumes you have already displayed a button on screen and added a listener to it that calls the function “moreButtonListener”
  • In Lua there is no button release listener. You must check the button listener event.phase for either “began” (touched) or “ended” (released)
  • The long condtional statement (if event.x > moreButton.x – moreButton.width/2 + 6 and event.x < moreButton.width + 22 and event.y > moreButton.y – 22 and event.y < moreButton.y + moreButton.height/2 – 6 then) is tracking the finger inside the button area. This is adjusted to the pixel to my liking for my button. Your number values could be completely different.
  • Use system.openURL( “itms-apps://itunes.com/apps/eggrollgames” ) to go straight to your developer page on the App Store with no redirects.

Resources

You can see this code in action by downloading the free Touch To Color Farm on the App Store here: http://itunes.apple.com/us/app/touch-to-color-farm-activity/id517339696?mt=8 While you’re at it, why not rate the app?

I hope this information is helpful. We love the development community and want to share and help wherever we can. Thanks for reading!

Posted in Programming | Tagged , , , , , , , , , , , , , , , , | Leave a comment