Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-26-2009, 01:52 PM   #1 (permalink)
ataranlen
Registered Member
 
ataranlen's Avatar
 
Join Date: Jun 2009
Location: Flower Mound, Texas
Age: 20
Posts: 34
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?
__________________
Apps I've coded:
Greeble
Cat Juggling
Garden 2 Go

Last edited by ataranlen; 06-30-2009 at 11:53 AM.
ataranlen is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,254
Threads: 39,032
Posts: 171,196
Top Poster: smasher (2,573)
Welcome to our newest member, dawoodajaz
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:04 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.