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.

DarkBASIC Professional Discussion / Scale Sprite/Offset Sprite

Author
Message
TheGroggyOne
17
Years of Service
User Offline
Joined: 11th Apr 2009
Location:
Posted: 18th Jan 2011 08:18
I have an image of a spaceship that's 400x100. I can load it up and offset it and it works fine, spinning the ship from the middle.

I decided to scale the ship down and the offset doesn't seem to work right. I can't seem to figure out how to re-center the offset after scaling it down.

Here's the code...


Without the SCALE SPRITE it works fine, but it spins around the nose of the ship when I scale it.

Sprite width and height report 100x100 before scaling and after scaling 50x50. I'm not sure what Offset is doing.

Thanks for any help.
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 18th Jan 2011 09:13
Maybe DarkBasic Pro offsets first before scaling?
This means that you need to ignore the scaling factor when offsetting the sprite. Maybe use the image width/height() instead of sprite width/height().

It's worth a shot.
Cheers!
Sven B

TheGroggyOne
17
Years of Service
User Offline
Joined: 11th Apr 2009
Location:
Posted: 19th Jan 2011 01:25
Image produced the same results.

I inadvertantly left the divide out when I was retyping it back in to use sprites again and it worked correctly


Unfortunately changing the divide in SCALE SPRITE to anything other than 2 causes the same incorrect offseting I was experiencing before and adjusting OFFSET SPRITE doesn't seem to help.

At any rate, I should have been looking for zooming instead of a scaling, which I've found several examples of on the forums.

Login to post a reply

Server time is: 2026-07-18 02:08:55
Your offset time is: 2026-07-18 02:08:55