Skip to content

Commit

Permalink
moved action on button
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdugne committed Dec 21, 2020
1 parent 48c3299 commit 20091a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cherry/components/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ function Button:create(options)
button.anchorChildren = true
button.anchorX = options.anchorX
button.anchorY = options.anchorY
button.action = options.action

local bg
if (options.bg) then
Expand Down Expand Up @@ -198,7 +199,7 @@ function Button:create(options)
local SCALE = 0.8
local scaleFrom = 1

if (options.action) then
if (button.action) then
gesture.onTap(
button,
function()
Expand All @@ -215,7 +216,7 @@ function Button:create(options)
if (button.scale) then
button:scale(scaleFrom / SCALE, scaleFrom / SCALE)
button.locked = false
timer.performWithDelay(10, options.action)
timer.performWithDelay(10, button.action)
end
end
}
Expand Down
1 change: 1 addition & 0 deletions cherry/core/game.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ function Game:start()
_G.log('🕹 Game is already running.')
return
end
_G.log('🕹 Game is starting...')

_G.isTutorial = App.user:isNew() and not _G['test-level']
self:reset()
Expand Down

0 comments on commit 20091a8

Please sign in to comment.