Breakout game guide wont work - any changes?

Hello!

I am new to Corona and the Lua language and i am following a guide to make the game “breakout”. 

I bought an e-book from amazon, but the guide doesnt seem to work properly. 

Here is the code:

local physics = require “physics”

physics.start()

physics.setGravity(0, 0)

system.setAccelerometerInterval( 100 )

local menuScreenGroup – displpay.newGroup()

local mmScreen

local playBtn

local background

local paddle

local brick

local ball

local scoreText

local scoreNum

local levelText

local levelNum

local alertDisplayGroup – display.newGroup()

local alertBox

local conditionDisplay

local messageText

local _W = display.contentWidth/2

local _H = display.contentHeight/2

local bricks = display.newGroup()

local brickWidth = 35

local brickHeight

local row

local column

local score = 0

local scoreIncrease = 100

local currentLevel

local vx = 3

local vy = -3

local gameEvent = “”

local isSimulator = “simulator” == system.getInfo(“environment”)

function main()

mainMenu()

end

function mainMenu()

menuScreenGroup = display.newGroup()

mmScreen = display.newImage(“mmScreen.png”, 0, 0, true)

mmScreen.x = _W

mmScreen.y = _H

playBtn = display.newImage(“playbtn.png”)

playBtn.setReferencePoint(display.CenterReferencePoint)

playBtn.x = _W; playBtn.y = _H + 50

menuScreenGroup:insert(mmScreen)

menuScreenGroup:insert(playBtn)

playBtn:addEventListener(“tap”, loadGame)

end

function loadGame(event)

if event.target.name == “playbutton” then

transition.to(menuScreenGroup,{time= 0, alpha=0, onComplete = addGameScreen})

playBtn:removeEventListener(“tap”, loadGame)

end

end

main()

Hi @rr-vent,

Welcome to Corona! It appears that the author of the e-book did not update the content when the Corona graphics engine was upgraded nearly 2 years ago. In specific, the “setReferencePoint” API was deprecated in favor of “anchor points”.

The following guide should help you with converting over older projects (or code from old examples) into the current graphics engine:

https://docs.coronalabs.com/guide/graphics/migration_g20.html

Best regards,

Brent

Hi @rr-vent,

Welcome to Corona! It appears that the author of the e-book did not update the content when the Corona graphics engine was upgraded nearly 2 years ago. In specific, the “setReferencePoint” API was deprecated in favor of “anchor points”.

The following guide should help you with converting over older projects (or code from old examples) into the current graphics engine:

https://docs.coronalabs.com/guide/graphics/migration_g20.html

Best regards,

Brent