/* * cocos2d for iPhone: http://www.cocos2d-iphone.org * * Copyright (c) 2008-2010 Ricardo Quesada * Copyright (c) 2011 Zynga Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ #import #import "CCDirector.h" #import "ccMacros.h" #import "CCAction.h" #import "CCActionInterval.h" #import "Support/CGPointExtension.h" // // Action Base Class // #pragma mark - #pragma mark Action @implementation CCAction @synthesize tag = tag_, target = target_, originalTarget = originalTarget_; +(id) action { return [[[self alloc] init] autorelease]; } -(id) init { if( (self=[super init]) ) { originalTarget_ = target_ = nil; tag_ = kCCActionTagInvalid; } return self; } -(void) dealloc { CCLOGINFO(@"cocos2d: deallocing %@", self); [super dealloc]; } -(NSString*) description { return [NSString stringWithFormat:@"<%@ = %08X | Tag = %i>", [self class], self, tag_]; } -(id) copyWithZone: (NSZone*) zone { CCAction *copy = [[[self class] allocWithZone: zone] init]; copy.tag = tag_; return copy; } -(void) startWithTarget:(id)aTarget { originalTarget_ = target_ = aTarget; } -(void) stop { target_ = nil; } -(BOOL) isDone { return YES; } -(void) step: (ccTime) dt { NSLog(@"[Action step]. override me"); } -(void) update: (ccTime) time { NSLog(@"[Action update]. override me"); } @end // // FiniteTimeAction // #pragma mark - #pragma mark FiniteTimeAction @implementation CCFiniteTimeAction @synthesize duration = duration_; - (CCFiniteTimeAction*) reverse { CCLOG(@"cocos2d: FiniteTimeAction#reverse: Implement me"); return nil; } @end // // RepeatForever // #pragma mark - #pragma mark RepeatForever @implementation CCRepeatForever @synthesize innerAction=innerAction_; +(id) actionWithAction: (CCActionInterval*) action { return [[[self alloc] initWithAction: action] autorelease]; } -(id) initWithAction: (CCActionInterval*) action { if( (self=[super init]) ) self.innerAction = action; return self; } -(id) copyWithZone: (NSZone*) zone { CCAction *copy = [[[self class] allocWithZone: zone] initWithAction:[[innerAction_ copy] autorelease] ]; return copy; } -(void) dealloc { [innerAction_ release]; [super dealloc]; } -(void) startWithTarget:(id)aTarget { [super startWithTarget:aTarget]; [innerAction_ startWithTarget:target_]; } -(void) step:(ccTime) dt { [innerAction_ step: dt]; if( [innerAction_ isDone] ) { ccTime diff = dt + innerAction_.duration - innerAction_.elapsed; [innerAction_ startWithTarget:target_]; // to prevent jerk. issue #390 [innerAction_ step: diff]; } } -(BOOL) isDone { return NO; } - (CCActionInterval *) reverse { return [CCRepeatForever actionWithAction:[innerAction_ reverse]]; } @end // // Speed // #pragma mark - #pragma mark Speed @implementation CCSpeed @synthesize speed=speed_; @synthesize innerAction=innerAction_; +(id) actionWithAction: (CCActionInterval*) action speed:(float)r { return [[[self alloc] initWithAction: action speed:r] autorelease]; } -(id) initWithAction: (CCActionInterval*) action speed:(float)r { if( (self=[super init]) ) { self.innerAction = action; speed_ = r; } return self; } -(id) copyWithZone: (NSZone*) zone { CCAction *copy = [[[self class] allocWithZone: zone] initWithAction:[[innerAction_ copy] autorelease] speed:speed_]; return copy; } -(void) dealloc { [innerAction_ release]; [super dealloc]; } -(void) startWithTarget:(id)aTarget { [super startWithTarget:aTarget]; [innerAction_ startWithTarget:target_]; } -(void) stop { [innerAction_ stop]; [super stop]; } -(void) step:(ccTime) dt { [innerAction_ step: dt * speed_];
name: "East Landscape"
panel_display_name: "East Landscape"
panels {
  name: "COLOR"
  path: "Panels/General/entry_10"
  clue: "color"
  answer: "purple"
  symbols: EXAMPLE
}
panels {
  name: "MISTREAT"
  path: "Panels/General/entry_13"
  clue: "mistreat"
  answer: "ream"
  symbols: EVAL
}