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, 04:47 PM   #3 (permalink)
ataranlen
Registered Member
 
ataranlen's Avatar
 
Join Date: Jun 2009
Location: Flower Mound, Texas
Age: 22
Posts: 66
Default

Code:
switch (plant1stage) {
		case 0:
			plant1water = 0;
			plant1fertilizer = 0;
			[plant1 stopAnimating];
			plant1.frame = CGRectMake(50, plant1.center.y-25, 50, 50);
			plant1.animationImages = empty_plot;
			[plant1 startAnimating];
			plant1stage = 0;
			break;
		case 1:
			if (plant1fertilizer >= required_fert_tree) {
				if (plant1water >= required_water_tree) {
					plant1water = 0;
					plant1fertilizer = 0;
					[plant1 stopAnimating];
					plant1.frame = CGRectMake(50, plant1.center.y-160, 320, 350);
					plant1.animationImages = apple_stage_1;
					[plant1 startAnimating];
					plant1stage = 2;
				} else {
					[plant1 stopAnimating];
					plant1.frame = CGRectMake(50, plant1.center.y-25, 50, 50);
					plant1.animationImages = empty_plot;
					[plant1 startAnimating];
					plant1stage = 0;
				}
			} else {
				[plant1 stopAnimating];
				plant1.frame = CGRectMake(50, plant1.center.y-25, 50, 50);
				plant1.animationImages = empty_plot;
				[plant1 startAnimating];
				plant1stage = 0;
			}
			break;
		case 2:
Thats the gist of my code, there are a total of 12 plants, each one has its one Water, Fertilizer, stage and image. The switch is designed to be the end of a day cycle that causes the plants to grow. They grow only if they have enough water and fertilizer.
ataranlen is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,839
Threads: 89,210
Posts: 380,647
Top Poster: BrianSlick (7,129)
Welcome to our newest member, Dheofin Jose
Powered by vBadvanced CMPS v3.1.0

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