Advertisement
Puffycheeses

Duck Breeding Simulator code (Cocoa)

Jul 1st, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.72 KB | None | 0 0
  1. //
  2. // AppDelegate.m
  3. // Duck breeding Simulator
  4. //
  5. // Created by Noah on 6/04/2014.
  6. // Copyright (c) 2014 Noah Heague. All rights reserved.
  7. //
  8.  
  9. #import "AppDelegate.h"
  10.  
  11. @implementation AppDelegate
  12.  
  13. - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
  14. {
  15. //What happens in the boot up process
  16. [_textLabel setStringValue:@"Push button breed a duck!"];
  17. [_congratalatoryBox setStringValue:@""];
  18. [_Score setStringValue:@"Ducks in enclosure: 0"];
  19.  
  20. [_Version setStringValue:@"Version 2.0"];
  21.  
  22. NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
  23. [nc addObserver:self
  24. selector:@selector(appWillTerminate:)
  25. name:NSApplicationWillTerminateNotification
  26. object:nil];
  27.  
  28. highScore = [[NSUserDefaults standardUserDefaults] integerForKey:@"HighScore"];
  29. [_fullScore setStringValue: [NSString stringWithFormat: @"Total Ducks: %li", (long)highScore]];
  30. }
  31.  
  32. //Cheat, add 99 score
  33. - (IBAction)Cheat:(id)sender {
  34. count = count+99998;
  35. [self button:nil];
  36. }
  37.  
  38. - (IBAction)button:(id)sender
  39.  
  40. {
  41. count ++;
  42. highScore ++;
  43.  
  44. // testing wheat to display depending on stuff
  45. NSString *string;
  46. string = [NSString stringWithFormat:@"🐣"];
  47.  
  48. if ([[_textLabel stringValue] isEqual: @"Push button breed a duck!"])
  49. {
  50. [_textLabel setStringValue:string];
  51. }
  52. else
  53. {
  54. NSString * newString = [NSString stringWithFormat:@"%@ 🐣", [_textLabel stringValue]];
  55. [_textLabel setStringValue: newString];
  56. }
  57. //Your scores
  58. [self howManyDucks];
  59. [_Score setStringValue: [NSString stringWithFormat:@"Ducks in enclosure: %i",count ]];
  60. [_fullScore setStringValue: [NSString stringWithFormat:@"Total Ducks: %li",(long)highScore ]];
  61.  
  62. }
  63.  
  64. //When you push new duck enclosure it resets everything back to defults
  65. - (IBAction)reset:(id)sender {
  66. [_textLabel setStringValue:@"Push button breed a duck!"];
  67. count = 0;
  68. [_congratalatoryBox setStringValue:@""];
  69. [_Score setStringValue:@"0"];
  70. }
  71.  
  72. //Creating a section to be accesed later by congratulatory box
  73. - (void)howManyDucks
  74. {
  75. if (count == 10) {
  76. [_congratalatoryBox setStringValue:@"10 ducks have been born in enclosure! congratulations life wasted!"];
  77. }
  78. else if (count == 20) {
  79. [_congratalatoryBox setStringValue:@"20 ducks have been born in enclosure! Hope you have a good mouse!"];
  80. }
  81. else if (count == 30) {
  82. [_congratalatoryBox setStringValue:@"30 ducks have been born in enclosure! you know this goes to 10005?"];
  83. }
  84. else if (count == 40) {
  85. [_congratalatoryBox setStringValue:@"40 ducks have been born in enclosure! Hope the mama duck doesnt go crazy!"];
  86. }
  87. else if (count == 50) {
  88. [_congratalatoryBox setStringValue:@"50 ducks have been born in enclosure! ...Your still playing?"];
  89. }
  90. else if (count == 100) {
  91. [_congratalatoryBox setStringValue:@"100 ducks have been born in enclosure! There are now 100, 100 ducks!?!"];
  92. }
  93. else if (count == 200) {
  94. [_congratalatoryBox setStringValue:@"200 ducks have been born in enclosure! The game is now on normal dificulty! Were going up by 100's!"];
  95. }
  96. else if (count == 300) {
  97. [_congratalatoryBox setStringValue:@"300 ducks have been born in enclosure! So your in fullscreen right? You should be..."];
  98. }
  99. else if (count == 400) {
  100. [_congratalatoryBox setStringValue:@"400 ducks have been born in enclosure! Nearly at 500! So close, i can smell it"];
  101. }
  102. else if (count == 500) {
  103. [_congratalatoryBox setStringValue:@"500 ducks have been born in enclosure! Were going up by 500's now, You will need 2 monitors to continue!"];
  104. }
  105. else if (count == 1000) {
  106. [_congratalatoryBox setStringValue:@"1000 ducks have been born! Two monitors? Three maybe, hell you might need 7 to win!"];
  107. }
  108. else if (count == 2000) {
  109. [_congratalatoryBox setStringValue:@"2000 ducks have been born in enclosure! A monitor is $1,199 you have $8983 right? Thats how much its gonna cost you to win!"];
  110. }
  111. else if (count == 3000) {
  112. [_congratalatoryBox setStringValue:@"3000 ducks have been born in enclosure! Your the duck breeding simulator king!"];
  113. }
  114. else if (count == 4000) {
  115. [_congratalatoryBox setStringValue:@"4000 ducks have been born in enclosure! I have a secret, Its a Valve secret."];
  116. }
  117. else if (count == 5000) {
  118. [_congratalatoryBox setStringValue:@"5000 ducks have been born in enclosure! Ok you win, there is totaly nothing at 10000..."];
  119. }
  120. else if (count == 10000) {
  121. [_congratalatoryBox setStringValue:@"Nothing"];
  122. }
  123. else if (count == 10005) {
  124. [_congratalatoryBox setStringValue:@"I am secretly working on HL3! Oh and you spent along time clicking this button..."];
  125. }
  126. else if (count == 10006) {
  127. [_congratalatoryBox setStringValue:@"Nothing, nah the game continues in 10000 now!"];
  128. }
  129. else if (count == 20000) {
  130. [_congratalatoryBox setStringValue:@"Welcome to the life of duck breeding simulator my friend!"];
  131. }
  132. else if (count == 30000) {
  133. [_congratalatoryBox setStringValue:@"Did you know?: Ducks in this enclosure are now dying by choking on each others feathers?"];
  134. }
  135. else if (count == 40000) {
  136. [_congratalatoryBox setStringValue:@"hey there is this cool game called life, Your heard of it? The graphics are amazing!"];
  137. }
  138. else if (count == 50000) {
  139. [_congratalatoryBox setStringValue:@"On 50000 mare duck to go until 100000! Holy crap you dont have a life."];
  140. }
  141. else if (count == 100000) {
  142. [_congratalatoryBox setStringValue:@"My point proven, you clicked the button 100000 times in one sitting. No life here! Im gonna stop awarding you for enclosure and award you for total ducks now! No cheating this time! :P"];
  143. }
  144. else if (highScore == 1000000) {
  145. [_congratalatoryBox setStringValue:@"Your still playing. Oh my god, You have either hacked your way here or your 12 and its the holidays. There is one more Thing... I think i forgot, i will tell you at 10000000"];
  146. }
  147. else if (highScore == 10000000) {
  148. [_congratalatoryBox setStringValue:@"Ah I remember! Thanks for playing this game! This is just my first application and its not that good. Please donate at the website and email us 1amadum8assl00k1ngf00rth3s3cr3tc0d3 for a prize"];
  149. }
  150. }
  151.  
  152. //Quit when window closes
  153. - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
  154. {
  155. return YES;
  156. }
  157.  
  158. - (void)appWillTerminate:(NSNotification *)note
  159. {
  160. [[NSUserDefaults standardUserDefaults] setInteger:highScore forKey:@"HighScore"];
  161. }
  162.  
  163. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement