Below is a code sample. You can also use a SKAction to move the object up and down instead of doing it manually like I have in the update method. It all depends on your code and what works best for you.
#import "MyScene.h"
@implementation MyScene
{
SKSpriteNode *object1;
SKSpriteNode *shadow;
BOOL goUp;
}
-(id)initWithSize:(CGSize)size
{
if (self = [super initWithSize:size])
{
object1 = [SKSpriteNode spriteNodeWithColor:[SKColor redColor] size:CGSizeMake(50, 50)];
object1.position = CGPointMake(100, 25);
[self addChild:object1];
shadow = [SKSpriteNode spriteNodeWithColor:[SKColor redColor] size:CGSizeMake(50, 50)];
shadow.position = CGPointMake(200, 25);
[self addChild:shadow];
goUp = true;
}
return self;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//
}
-(void)update:(CFTimeInterval)currentTime
{
if((goUp == true) && (object1.position.y == 200))
goUp = false;
if((goUp == false) && (object1.position.y == 25))
goUp = true;
if(goUp == true)
{
object1.position = CGPointMake(object1.position.x, object1.position.y+1);
shadow.alpha -= 0.005;
}
if(goUp == false)
{
object1.position = CGPointMake(object1.position.x, object1.position.y-1);
shadow.alpha += 0.005;
}
}
@end