Adding a play/pause button

Hi guys,

İ really need to help adding play/pause buttons. 

Hi thardal23, you’ll need to be a little more specific to get very detailed responses… what have you done so far? what is going on that you want to start/pause?

Generally, you will need to create a new display image for the start/pause button (from any image file you choose) - https://docs.coronalabs.com/daily/api/library/display/newImage.html

Then you will need to use an event listener for that image, probably listening for a “tap”, and then call a play/pause function - https://docs.coronalabs.com/api/type/EventListener/addEventListener.html

Then you need to tell the app what to do within that function; essentially, you would want to change the play/pause button so that next time it is clicked it goes to a different function (e.g. when clicked to ‘play’, it needs to be set so that the next time it goes to ‘pause’) and also do whatever is required to actually play or pause your app - possibly as simple as turning on or off physics/gravity/etc. - http://www.lua.org/pil/6.html

Cheers,

Simon

aka DixonCourt

Hi thardal23, you’ll need to be a little more specific to get very detailed responses… what have you done so far? what is going on that you want to start/pause?

Generally, you will need to create a new display image for the start/pause button (from any image file you choose) - https://docs.coronalabs.com/daily/api/library/display/newImage.html

Then you will need to use an event listener for that image, probably listening for a “tap”, and then call a play/pause function - https://docs.coronalabs.com/api/type/EventListener/addEventListener.html

Then you need to tell the app what to do within that function; essentially, you would want to change the play/pause button so that next time it is clicked it goes to a different function (e.g. when clicked to ‘play’, it needs to be set so that the next time it goes to ‘pause’) and also do whatever is required to actually play or pause your app - possibly as simple as turning on or off physics/gravity/etc. - http://www.lua.org/pil/6.html

Cheers,

Simon

aka DixonCourt