Okay sorry I figured out why that wasn't working but it brings me to another problem.
So I will just show you my code:
void Character::Update()
{
///////////This is where I set the position of the box and I am using box2d so I paste the sprite onto the box 2d collision box//////
Position = playerBody->GetPosition();
Position.x *= b2PixelRatio;
Position.y *= b2PixelRatio;
dbSprite(iD,Position.x,Position.y,2);
dbPasteSprite(iD,Position.x,Position.y);
if ( checkLeft() )
{
playerBody->ApplyImpulse(b2Vec2(-5,0),b2Vec2(Position.x,Position.y));
}
if ( checkRight() )
{
playerBody->ApplyImpulse(b2Vec2(5,0),b2Vec2(Position.x,Position.y));
}
if ( checkUp() )
{
playerBody->ApplyImpulse(b2Vec2(0,-10),b2Vec2(Position.x,Position.y));
}
if (LeftMouseClicked())
{
Primary();
}
}
////////////I want to be able to set the position of my physics box equal to the position of the mouse///////////////////
void Character::Primary()
{
Position.x = dbMouseX();
Position.y = dbMouseY();
}
So the code I have in Primary is very basic but it's really just to give you guys an idea of what I want to do. I mean some how I need to get Position.x and y equal to the mouse. Any ideas on what I should do?