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 issue

Author
Message
Naphier
15
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 24th Nov 2011 20:59
Hi. I'm trying to scale a sprite so as to zoom in on it, but the offset sprite command is producing unanticipated results by limiting the sprite size to 1/2 screen height and 1/2 screen width instead of setting a center point for the sprite.
I'm not seeing why.
Please see attached code and help with my logic if possible.
Thanks!



I've tried putting the offset sprite command outside and inside of the scaling loop. Not sure why it's shrinking it to 1/4 of the screen.

~Napland Games~
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Nov 2011 23:07
Nope, not seeing it:


The offset for sprites should be based on their original size, not their scaled size. Scaling isn't limited at all (although obviously the detail will disappear).

Naphier
15
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 25th Nov 2011 18:39
Thanks for the example code.
My issue was that I was putting the sprite's origin at 0,0 and offsetting the sprite to it's center, thus making it look like it was only taking the upper left quadrant of the screen.

sprite 1, screen width()/2,screen height()/2, 1
was the answer

Here's your code, with a sprite the size of the screen (as I was trying to accomplish):





and my code corrected:



~Napland Games~

Login to post a reply

Server time is: 2026-07-10 01:58:29
Your offset time is: 2026-07-10 01:58:29