Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hackmods

macrumors newbie
Original poster
Feb 8, 2010
3
0
Hey guys,

I wrote a basic who's that pokemon app today and im trying to add scores and lives.

First for lives I diclare this near the begining of my .m file

Code:
#import "Who_s_That_Pokemon_ViewController.h"

@implementation Who_s_That_Pokemon_ViewController

int	health = 4;

when a wrong pokemon name is picked it runs this method

Code:
-(void) calcHealth {
	if (health == 1)
	{
		ball3.hidden= NO;
	}
	else if (health == 2)
	{
		ball1.hidden = YES;
		health = health - 1;
	}
	else if (health == 3)
	{
		ball2.hidden == YES;
		health = health - 1;
	}
	else if (health == 4)
	{
		ball3.hidden = YES;
		health = health - 1;
	}
}
the ball variable refer to pictures, it hides the 3 pokeballs to show you missed 3 pokemon. When it runs the first time it works fine. but after the first time it skips to health ==1 for some reason.

any insight?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.