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.

2D All the way! / dbSpriteWidth and Height question

Author
Message
Poof Master
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location:
Posted: 1st Feb 2010 04:17
So Basically I am trying to use dbSpriteWidth and height in this function:


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:



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


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?
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 9th Feb 2010 18:44
Quote: "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. "


Negative one is ussually a error indicator. Are you sure you have used the dbSprite function to create the sprite before calling dbSpriteWidth/Height?

New Site! Check it out \/

Login to post a reply

Server time is: 2024-04-25 13:54:22
Your offset time is: 2024-04-25 13:54:22