I have a pretty well-developed SpriteKit game that I'm working on, I added code to add a new SKSpriteNode script to the scene (just like I did dozens of other places in the code, but for some reason this time just ignoring the position that I installed for node, I tried it with explicit .position = CGPointMake (x, y) and tried [node setPosition: CGPointMake (x, y)]
None of them work ... node is added to the scene, but ALWAYS at 0.0, no matter what I do, checked both x and y to make sure they are valid and are in the range of the scene and tried use explicit floats, etc., and it doesnβt matter what I do, this node is always mapped to 0.0, and this is completely pointless. I do the same thing as I do with dozens of other nodes during the game, but this node just will not appear anywhere other than 0.0, regardless of what I do:
int width = 64; SKSpriteNode *node = [[SKSpriteNode alloc] initWithColor:[SKColor grayColor] size:CGSizeMake(width,25)]; node.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:node.size]; node.physicsBody.dynamic = NO; node.physicsBody.categoryBitMask=nodeCategory; node.name=@ "node"; node.position = CGPointMake(200,250);
I am completely at a loss here, I tried adding .0 to the inputs in CGPointMake to make sure they are processed, since nothing is floating ... No matter what I do with this node, when it is added to the scene it is always by default takes a 0,0 position, and I'm upset, I add all kinds of nodes without incident, just something about this node addition that just doesn't work, and can't figure out what is different or why.
source share