diff --git a/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/Mima.xcuserdatad/UserInterfaceState.xcuserstate b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/Mima.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..d3ffcd5 Binary files /dev/null and b/IfElse/IfElse.xcodeproj/project.xcworkspace/xcuserdata/Mima.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/IfElse/IfElse.xcodeproj/xcuserdata/Mima.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/IfElse/IfElse.xcodeproj/xcuserdata/Mima.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/IfElse/IfElse.xcodeproj/xcuserdata/Mima.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/IfElse/IfElse.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/IfElse.xcscheme b/IfElse/IfElse.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/IfElse.xcscheme new file mode 100644 index 0000000..6485954 --- /dev/null +++ b/IfElse/IfElse.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/IfElse.xcscheme @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IfElse/IfElse.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/xcschememanagement.plist b/IfElse/IfElse.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..44aa48b --- /dev/null +++ b/IfElse/IfElse.xcodeproj/xcuserdata/Mima.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + IfElse.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 8DFE63E81B22A54400D3D7AA + + primary + + + 8DFE64011B22A54400D3D7AA + + primary + + + + + diff --git a/IfElse/IfElse/Base.lproj/Main.storyboard b/IfElse/IfElse/Base.lproj/Main.storyboard index 34c014c..dd185c6 100644 --- a/IfElse/IfElse/Base.lproj/Main.storyboard +++ b/IfElse/IfElse/Base.lproj/Main.storyboard @@ -1,8 +1,7 @@ - + - @@ -19,99 +18,85 @@ - + + + + - + + + + - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/IfElse/IfElse/ViewController.h b/IfElse/IfElse/ViewController.h index 406a385..64a62c3 100644 --- a/IfElse/IfElse/ViewController.h +++ b/IfElse/IfElse/ViewController.h @@ -1,3 +1,4 @@ + // // ViewController.h // IfElse diff --git a/IfElse/IfElse/ViewController.m b/IfElse/IfElse/ViewController.m index b3ee131..68a68ac 100644 --- a/IfElse/IfElse/ViewController.m +++ b/IfElse/IfElse/ViewController.m @@ -8,20 +8,94 @@ #import "ViewController.h" +// view controller +// @interface declaring attributes of view controller +// attributes @interface ViewController () - +@property (weak, nonatomic) IBOutlet UITextField *text1; +@property (weak, nonatomic) IBOutlet UITextField *text2; +@property (weak, nonatomic) IBOutlet UITextField *text3; +@property (weak, nonatomic) IBOutlet UISwitch *toggle; +@property (weak, nonatomic) IBOutlet UILabel *question1; @end -@implementation ViewController +// IBoutlet shows the link between code and interface + +@implementation ViewController // action of the button + - (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. + self.question1.text = @"Do you want to attack the squirrel?"; + self.text2.text = @"0"; + self.text3.text = @"0"; + + int value2 = [self.text2.text intValue]; + int value3 = [self.text3.text intValue]; + + // Converting String into Integer + // NSString *intString = @”1″; + // int value = [intString intValue]; + + NSString *one = self.text1.text; + //NSString *two = self.text2.text; + //NSString *three = self.text3.text; + + + } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. +- (IBAction)buttonTapped:(id)sender { + NSLog(@"Tapped!"); + + + + + /*BOOL oneEqualsTwo = [one isEqualToString: two]; + + if (oneEqualsTwo){ + [self.toggle setOn: YES animated: YES]; + NSLog(@"first two are =="); + } else { + [self.toggle setOn: NO animated: YES]; + } + + BOOL oneEqualsThree = [one isEqualToString: three]; + if (oneEqualsThree){ + [self.toggle setOn: NO animated:YES]; + } else { + [self.toggle setOn: YES animated: YES]; + }*/ + + int playerHP = 100; + int enemyHP= 100; + //BOOL playerLive = playerHP > 0; + + while(playerHP > 0){ + + BOOL oneEqualsYes = [one isEqualToString: @"Yes"]; + BOOL oneEqualsNo = [one isEqualToString: @"No"]; + + + if(oneEqualsYes){ + playerHP = playerHP - 3; + enemyHP = enemyHP - 10; + self.text2.text = ([NSString stringWithFormat:@"Player HP: %d", playerHP]); + self.text3.text = ([NSString stringWithFormat:@"Enemy HP: %d", playerHP]); + NSLog(@"%d", playerHP); + + } else if (oneEqualsNo) { + playerHP = playerHP - 15; + self.text2.text = ([NSString stringWithFormat:@"Player HP: %d", playerHP]); + } + + /*if(oneEqualsPoop){ + self.text3.text = (@"yeeeee!"); + }*/ + } + + + + } @end