Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Box2d Physics Engine Help

Author
Message
Poof Master
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location:
Posted: 30th Jan 2010 05:30
So I have implemented the Box2d into the dark GDK and have just ran into one problem.

Basically it has to do with this function from Box2d






For some reason the dbSpriteWidth and Height doesn't work inside of this function. When I hard code the numbers to fit the parameters of my sprite the collision works fine. Like So:






This code works but I need it to be able to work with the dbSpriteWidth and Height function. Anyone know why it would not work with dbSpriteWidth? Or does dbSpriteWidth not hold the actually value of the sprites width? and if that's the case what would be the best way to go about getting a sprites width and height without hard coding it?
Aldur
16
Years of Service
User Offline
Joined: 8th Oct 2007
Location: Melbourne, Australia
Posted: 30th Jan 2010 12:52
Does it work if you assign the sprite width and sprite height to a variable before using them in that function?

Poof Master
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location:
Posted: 30th Jan 2010 22:05
I just tried that and I get the same result. When I look at the watch list for those variables they are all assigned a value of -1. So I guess dbSpriteWidth and Height don't hold the actual value of the sprites width and height. Wierd thing is though when I call dbOffsetSprite I use dbSpriteWidth and height to change it to the center. Like so:



I know this function works so why wouldn't it work with the other function?

Login to post a reply

Server time is: 2024-10-01 23:27:44
Your offset time is: 2024-10-01 23:27:44