getting sprite coordinates

Mar 5, 2013 at 11:50 AM
Edited Mar 5, 2013 at 11:52 AM

Im trying to adjust the gravity based on the position of a little ball in the world so it will always roll back to the center.
But position of the sprite is always NaN.

I've tried this in Game_Timerloop:
            Point pos = new Point(ballSprite.BodyObject.Position.X, ballSprite.BodyObject.Position.Y);
i get a reference to the object on game_loading like this:
ballSprite = this.GameContainer.PhysicsObjects["ballSprite"];
Mar 5, 2013 at 12:06 PM
That seems odd, you should be seeing the coordinates in world x, y - I'm not sure what's up there.

But I think you want the coordinates in screen x,y anyway... which you could get with:
Does that give you valid coordinates?
Mar 5, 2013 at 12:13 PM
I have an error placing sprites manually on the canvas, when i disables placing the sprites from code and only let the engine handle the xaml defined sprites.. it all went back to what it should be.

sorry for wasting youre time