As of December 2010 part 1 of my OpenFeint tutorial is no longer valid. This tutorial replaces it and will show you how to get OpenFeint working in your iPhone app.
Obviously with the new SDK things have changed. My old tutorials for OpenFeint and Facebook are now useless – but never fear! Despite it being the 19th of December and there being less than a week until Christmas, I am planning to post new tutorials for both OpenFeint and Facebook before Christmas day.
Parts 2 and 3 (achievements and leaderboards) of my OpenFeint tutorial are still valid. What has changed is how we set up and initiate OpenFeint – which was part 1. The following will get you up and running again.
Let’s get started as I really must get back to cleaning, wrapping and trying to find something thoughtful to write in my De Facto Mother in law’s card to make up for the fact I was too broke to buy her a very nice gift.
STEP ONE: Open your main.lua file or, if you are using director, open menu.lua or whatever your first game screen/scene is. Remove any old code relating to OpenFeint, except that linked to a button. If you have a button to launch the dashboard, leave it be, it will work again when we’re done. (If you are adding OpenFeint for the first time, simply open the file relating to the first screen/scene in your app.)
STEP TWO: Copy and paste the below code near the start of the file. (I place it immediately below any code relating to director.)
local openfeint = require "openfeint"
local of_product_key = "yourkey"
local of_product_secret = "yoursecret"
local of_app_id = "yourappid"
local display_name = "Your App Name"
openfeint.init ("yourkey", "yoursecret", "Your App Name", "yourappid")
--> Sets OpenFeint up
STEP THREE: Go to the OpenFeint Website and get your app’s information. Use it to replace all of the writing in green above. Keep the quotes in, removing them will break the code.
STEP FOUR: For those of you who need to know how to set up a button to launch the dashboard, this code will do it (assuming you already have a button named openfeintbutton);
local function opendash (event)
if event.phase == "ended" then
IN CLOSING: There have been some changes made but they are easy to accommodate for. Parts 2 and 3 of the OpenFeint Tutorial remain the same.
And that’s it!
I hope this helps everyone get OpenFeint working again. Hopefully I’ll have a Facebook Tutorial up on Tuesday, depending on how I feel after visiting the dentist. (That’s right, I’m going to attempt to write it after getting home from the dentist – the things I do for you people!)
Peach Pellen o<=]