Hi,
here’s my main.lua code :
[lua]local centerX = display.contentCenterX
local centerY = display.contentCenterY
local _W = display.contentWidth
local _H = display.contentHeight
local gameNetwork = require “gameNetwork”
gameNetwork.init(“google”)
local leaderboardId = “” – Your leaderboard id here
gameNetwork.request(“login”,{userInitiated = true})
local function submitScoreListener(event)
gameNetwork.request(“setHighScore”,
{
localPlayerScore =
{
category = leaderboardId, – Id of the leaderboard to submit the score into
value = 100 – The score to submit
}
})
end
local function showLeaderboardListener(event)
gameNetwork.show(“leaderboards”) – Shows all the leaderboards.
end
local storyboard = require (“storyboard”)
local btn = display.newText(“play1”, 0, 0, nil, 50)
btn.x=_W/2; btn.y=_H/2 - 30;
local btn2 = display.newText(“leaderboards”, 0, 0, nil, 50)
btn2.x=_W/2; btn2.y=_H/2+20;
local btn3 = display.newText(“submit”, 0, 0, nil, 50)
btn3.x=_W/2; btn3.y=_H/2+60;
function tbtn(e)
if e.phase == “ended” then
btn:removeSelf()
storyboard.gotoScene(“game2”)
end
end
function tbtn2(e)
if e.phase == “ended” then
showLeaderboardListener()
end
end
function tbtn3(e)
if e.phase == “ended” then
submitScoreListener()
end
end
btn:addEventListener(“touch”, tbtn)
btn2:addEventListener(“touch”, tbtn2)
btn3:addEventListener(“touch”, tbtn3)[/lua]
but after building the game and trying to open it on device, the app stops and shows a pupup saying :
unfortunately, application has stopped.