So when I press the back key the app just quits and shaking does nothing. Not sure what Im doing wrong. Ive tried a different ways for the IF statement but doesnt seem to matter
[lua]
function onKeyEvent( event )
local keyname = event.keyName;
if ((event.phase == “up”) and (event.keyName==“back”)) then
transition.to(introScreenGroup, {time = 300, x =0, onComplete = function()
gameScreenGroup.x = -900
audio.stop(1)
audio.rewind(1)
audio.play(musicIntro, {channel=1, loops=-1})
ads.show (“banner”, {x=0,y=430,appId=adsBannerID })
end})
return true;
end
end
Runtime:addEventListener( “key”, onKeyEvent );
function onShake(event)
if (event.isShake == true) then
if (achieveReached[8] == 0) then
achieveReached[8] = 1
gameNetwork.request( “unlockAchievement”,
{achievement = { identifier=gpgAchieve8ID,
percentComplete=100, showsCompletionBanner=true }} )
end
end
end
Runtime:addEventListener(“accelerometer”, onShake)
[/lua]