I'm making a game using Objective-C and Sprite Kit and I've encountered a problem I can't get a workaround for so after hours of trying myself, I've considered asking you here.
I've created an animation using CoreAnimator and the result is given as an UIView
object. I've added the object as a subview for my main view in the GameViewController
and it is displayed and animated correctly. But now I would like to link it with another object.
Previously when I was just using a placeholder animation, I used it as a regular SKSpriteNode
so if object A was an SKNode
then we could link them together simply by using [objectA addChild:objectB]
. That worked really fine and I would like to keep it that way. But now since objectB is no longer a node, but a UIView
I can't really use addChild
anymore.
Can you know or can think of any workaround for this problem?
GameScene:
Parent:
_objectA = [[SKNode alloc] init];
_objectA.position = CGPointMake([[UIScreen mainScreen] bounds].size.width * -0.35,
[[UIScreen mainScreen] bounds].size.height * -0.26);
_objectA.zPosition = 0.9;
[_worldContainer addChild:_objectA];
Child:
_objectB = [self.view viewWithTag:123];
[_objectB addTopAnimation];
GameViewController:
_objectB = [[TestAnimView alloc] init];
_objectB.tag = 123;
_objectB.transform = CGAffineTransformMakeScale(0.6, 0.6);
_objectB.layer.anchorPoint = CGPointMake(0.5, 0);
_objectB.layer.position = CGPointMake([[UIScreen mainScreen] bounds].size.width * 0.139,[[UIScreen mainScreen] bounds].size.height * 0.49);
[self.view addSubview:_objectB];