Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-15-2011, 04:04 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 1
RunOfTheMill is on a distinguished road
Question How does xcode handle variables?

Now my question might be a little vague but heres what I'm trying to ask. How would I be able to store a variable...close an app, reopen, and have that variable kept as a sort of permanent/temporary track of how well the gamer is doing?
So far with the game I've coded I've noticed that every time the game closes/switches to another view/ the game starts off from scratch with the initial 0s for the score and so on. I want to change that so it at least keeps or maintains them until the user presses a reset button (which I haven't added yet, but I'm sure it won't take long to figure out). (granted I know I'm going to have to save and load the numbers from a file or something similar {but I don't know how, yet}.

So what I've got: A fully functioning game that only keeps track of the score when you're actually playing (I know I'm a serious gamer but I know the importance of a break) and a semi-clear understanding of how xcode works (I'm still getting the hang of it).

Oh and of coarse if the user would like to post the highscore *my score relies on two variables a total and a percent (of coarse a higher total represents a better score [due to effort] so long as the percent isn't low)...where/how exactly does that work? From my understanding its a simple server universal to iphone apps called Game Center w/ leaderboards for every app/game and a sort of framework kit or other in xcode that has some predefined code to send in scores.

Any help would be appreciated, my game will not be going on the market all too soon. I'm still in the process of cleaning up the graphics (It looks terrible, I'm no artist).
RunOfTheMill is offline   Reply With Quote
Old 09-15-2011, 07:48 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 106
applegend419 is on a distinguished road
Default

Quote:
Originally Posted by RunOfTheMill View Post
Now my question might be a little vague but heres what I'm trying to ask. How would I be able to store a variable...close an app, reopen, and have that variable kept as a sort of permanent/temporary track of how well the gamer is doing?
So far with the game I've coded I've noticed that every time the game closes/switches to another view/ the game starts off from scratch with the initial 0s for the score and so on. I want to change that so it at least keeps or maintains them until the user presses a reset button (which I haven't added yet, but I'm sure it won't take long to figure out). (granted I know I'm going to have to save and load the numbers from a file or something similar {but I don't know how, yet}.

So what I've got: A fully functioning game that only keeps track of the score when you're actually playing (I know I'm a serious gamer but I know the importance of a break) and a semi-clear understanding of how xcode works (I'm still getting the hang of it).

Oh and of coarse if the user would like to post the highscore *my score relies on two variables a total and a percent (of coarse a higher total represents a better score [due to effort] so long as the percent isn't low)...where/how exactly does that work? From my understanding its a simple server universal to iphone apps called Game Center w/ leaderboards for every app/game and a sort of framework kit or other in xcode that has some predefined code to send in scores.

Any help would be appreciated, my game will not be going on the market all too soon. I'm still in the process of cleaning up the graphics (It looks terrible, I'm no artist).
you can store variables as NSUserDefaults and have them accesible until the user deletes the app
applegend419 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 384
13 members and 371 guests
7twenty7, apatsufas, comicool, Creativ, Dalia, dansparrow, Duncan C, HemiMG, heshiming, LunarMoon, Murphy, pbart, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:55 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0