So Basically I am trying to use dbSpriteWidth and height in this function:
playerShapeDef.SetAsBox((dbSpriteWidth(1)/b2PixelRatio)/2.0f, (dbSpriteHeight(1)/b2PixelRatio)/2.0f);
From what I understand dbSpriteWidth and height return the value of what ever the given sprite is. Problem is when I use in this function it doesn't. Now I know the function works because when I hard code it like so:
playerShapeDef.SetAsBox((90/b2PixelRatio)/2.0f, (90/b2PixelRatio)/2.0f);
The program works and I have collision. I have tried setting dbSpriteWidth and Height equal to a variable that I created but when I debug it and use the window watcher the value of those variables is -1.
Here's the weird thing though when I use dbSpriteWidth and Height in this function
dbOffsetSprite(1, dbSpriteWidth(1)/2,dbSpriteHeight(1)/2);
It does work and offsets the sprite based off the width and height of the sprite.
So I guess I am just confused on how dbSpriteWidth and Height work. Can anyone explain whats going on? Also any suggestions on how to not have to hard code all of my sprites width and heights?