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! / Curious behaviour of OFFSET SPRITE

Author
Message
Agent
19
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 31st Aug 2013 18:59 Edited at: 31st Aug 2013 19:07
Hey guys. It's been a while since my last lurk, but I'm back with a question regarding OFFSET SPRITE.

I'm creating an animated intro sequence for my latest game project to tell its story - you know, opening credit sequence with a series of slides and overlaid text to tell the story.

I'm using a series of fullscreen images, loading them in one at a time and displaying them, then manipulating them in minor ways for the purpose of animation, such as slowly zooming in on the center of the image, or zooming out, or using a very wide image and scrolling it slowly to the left to pan across the image. Simple stuff.

So I'm using the following code to create, manipulate and then draw the image:



Most of this should be self explanatory: Create the sprite and immediately hide it. Resize it to the size of the screen (which is variable, determined by an external .ini file at boot). Offset to the centre of the sprite so that I can always draw it to the same coordinates regardless of its scale. Then change that scale for the purpose of zooming in or out over time. Then actually paste the finished product to the screen.

Now, if I *omit* the scale command, everything works as expected - the image will be resized to fit the screen and drawn to its exact center, filling the screen perfectly with the image.

If I include the scale command, I get an odd result: The image seems to scale correctly but the offset is no longer correct - check it out:

Without SCALE

With SCALE

If I perform the SIZE and SCALE commands before the OFFSET, the image seems to be offset far outside the bounds of the image itself, like +2000 in each dimension.

My question then, is what are the rules of offsetting an image? What can I and can't I do to a sprite after it's been offset without messing up the offset?

Agent
19
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 1st Sep 2013 00:13 Edited at: 1st Sep 2013 00:16
Does the screen resolution affect any of the relevant commands? What about changing the screen resolution at runtime? Might that affect the function of OFFSET SPRITE? I seem to be getting different results. At 1280x1024 everything functions exactly as expected, but if I change the resolution to anything else, things aren't drawing as expected. The size of the images are all 1280x1024. Coincidence? Things only function as expected if the images are exactly the size of the screen.

I'm just posting my findings as I come across them in the hopes someone might put two and two together. I still can't figure it out.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Sep 2013 05:18
I played around with it a little bit. It appears scale sprite ignores size sprite. Whatever the case, the two commands definitely don't play well together. I'd stick to using one or the other command.

Login to post a reply

Server time is: 2024-04-19 08:39:45
Your offset time is: 2024-04-19 08:39:45