Reputation: 117
Hi I have class that contains CCsprite and Im using that class in the gamelayer to walk around. I wanted to get current position of the Node so I called,
NSLog(@"%d",myClass.sprite.position.x);
NSLog(@"%d",myClass.sprite.position.y);
or
NSLog(@"%d",myClass.position.x);
NSLog(@"%d",myClass.position.y);
But it only returns 0 value in console. Im I dealing with wrong thing here?
Upvotes: 0
Views: 153
Reputation: 8147
The position
member variable is of type CGFloat
, so the correct flag for it's members (x
and y
, both floats) is %f
, not %d
.
Upvotes: 1
Reputation: 40221
Try NSLog("%@", NSStringFromPoint(self.position));
or NSLog("%@", NSStringFromPoint(sprite.position));
depending on where you call this from.
Upvotes: 1