lua - How to change image based on number of taps in Corona? -


i'm using corona sdk , have this. when tap on image number increases. wonder how change image once reached amount of clicks?

   display.setstatusbar(display.hiddenstatusbar)     local newbutton = display.newimage ("button.png",0,0)    newbutton.x = display.contentwidth - 60    newbutton.y = display.contentheight - 62.5     local number = 0    local textfield = display.newtext(number, 30, 30, native.systemfont, 25)     local function movebuttonrandom(event)        number = number + 1        textfield:removeself()        textfield = display.newtext(number, 30, 30, native.systemfont, 25)    end      newbutton:addeventlistener("tap", movebuttonrandom) 

the best practice use sprite , when increment point, tell sprite play next frame.

there multiple tutorial on working imagesheets , sprites here: http://coronalabs.com/resources/tutorials/images-audio-video-animation/

rob


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -