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 Twitter to your apps


We're going to implement Twitter in our apps by accessing a web service through UI buttons.

  1. In the Chapter 9 folder, copy the Twitter 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 so that the event receives a "release" action:

    local onOpenTouch = function( event )
      if event.phase == "release" then
  5. Using the local variable called message, add in the following string statement and concatenate score:

    local message = "Posting to Twitter from Corona SDK and got a final...