Posted By

izrak on 11/15/12


Tagged

scroll cocos2d


Versions (?)

vertical lock scroll


 / Published in: Objective C
 

Was used to unlock paid powerups

  1. -(void)setPuLocked:(NSNumber *)locked
  2. {
  3. puLocked=[locked boolValue];
  4. }
  5.  
  6. -(void)lockPU
  7. {
  8. if (puLocked)
  9. return;
  10.  
  11. [slideToUnlockIcon runAction:[CCMoveBy actionWithDuration:.2 position:CGPointMake(0, -88)]];
  12. [puBombLock runAction:[CCFadeIn actionWithDuration:.2]];
  13. [puManaLock runAction:[CCFadeIn actionWithDuration:.2]];
  14.  
  15. [self performSelector:@selector(setPuLocked:) withObject:[NSNumber numberWithBool:YES] afterDelay:.25];
  16. }
  17.  
  18. //at init
  19. puLocked=YES;
  20.  
  21. //when swiped vertically unlock with
  22. [self unlockPU];
  23.  
  24. //somewhere in the class
  25. -(void)unlockPU
  26. {
  27. if (!puLocked)
  28. return;
  29.  
  30. puLocked=NO;
  31.  
  32. [slideToUnlockIcon runAction:[CCMoveBy actionWithDuration:.2 position:CGPointMake(0, 88)]];
  33. [puBombLock runAction:[CCFadeOut actionWithDuration:.2]];
  34. [puManaLock runAction:[CCFadeOut actionWithDuration:.2]];
  35.  
  36. [self performSelector:@selector(lockPU) withObject:nil afterDelay:5];
  37. }
  38.  
  39. //also had icons on the PU butons
  40. puManaLock = [CCSprite spriteWithFile:@"pu_lock.png"];
  41. SET_POS(puManaLock, 449, 60);
  42.  
  43. puBombLock = [CCSprite spriteWithFile:@"pu_lock.png"];
  44. SET_POS(puBombLock, 449, 121);
  45. [self addChild:puManaLock z:1010];
  46. [self addChild:puBombLock z:1010];
  47.  
  48. //slider
  49. slideToUnlockIcon = [CCSprite spriteWithFile:@"Btn_PowerUpSlider.png"];
  50. SET_POS(slideToUnlockIcon,444, 256);
  51.  
  52. [self addChild:slideToUnlockIcon z:10];

Report this snippet  

You need to login to post a comment.