Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By : Michelle M Fernandez
Book Image

Corona SDK Mobile Game Development: Beginner's Guide

By: Michelle M Fernandez

Overview of this book

Table of Contents (19 chapters)
Corona SDK Mobile Game Development Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – adding Facebook to your apps


Similar to our Twitter example, we'll be incorporating Facebook posts with a web popup as well:

  1. In the Chapter 9 folder, copy the Facebook Web Pop-Up project folder to your desktop. All the configuration, libraries, and assets needed are already included. You can download the project files that accompany this book from the Packt Publishing website.

  2. Create a new main.lua file and save it to the project folder.

  3. Set the following variables at the beginning of the code:

    display.setStatusBar( display.HiddenStatusBar )
    
    local ui = require("ui")
    
    local openBtn
    local closeBtn
    local score = 100
  4. Create a local function called onOpenTouch() with an event parameter. Add an if statement when the event receives a "release" action:

    local onOpenTouch = function( event )
      if event.phase == "release" then
  5. Add the following local variables that include the strings that we'll be implementing in the Facebook post:

        local appId = "0123456789" -- Your personal FB App...