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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-26-2009, 02:52 PM   #1 (permalink)
ataranlen
Registered Member
 
ataranlen's Avatar
 
Join Date: Jun 2009
Location: Flower Mound, Texas
Age: 22
Posts: 66
Default How to simplify this code block?

I'm looking for a way to simplify some of my code so it doesn't take up 18,000 lines. Basically the code is the same code inside 12 switches.
Code:
Switch (1stage){
     case 0:
     1.animationimages = empty; // this is an array of image filenames, works fine
     break;
     case 1:
     if (1stuff >= 3){
          if (1otherstuff >= 3{
               1stage++; 
               1stuff = 0;
               1otherstuff = 0;
               1.animationimages = newstageimage; // this is an array of image filenames, works fine
          }
     }
And so on for 112 stages
What I'm having trouble finding how to do is creating an array of each of the 12 items and a forLoop that makes the changes for each of the items in the array. Thus reducing my 18,000 lines of code to only 1700ish.
Any suggestions?
__________________
Nathan Stoltenberg
Lead Programmer - Fractal Fox Studios
Mobile Applications Consultant - The Principal Consulting

Apps I've coded:
Greeble, Cat Juggling, and Garden 2 Go

1CJd8W6JiGKEgKHYp4PvWXWsnemHd8uqr7

Last edited by ataranlen; 06-30-2009 at 12:53 PM.
ataranlen is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,722
Threads: 89,178
Posts: 380,499
Top Poster: BrianSlick (7,124)
Welcome to our newest member, idny99
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:40 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.