can an overlay move 1 pixel at a time, if using low res coordinates?

Started by EnterTheStory (aka tolworthy), Wed 24/03/2010 17:43:40

Previous topic - Next topic

EnterTheStory (aka tolworthy)

Sorry for posting so many questions lately. I'll go back to hibernation soon, promise :) But just one more:

I have some games that use low resolution coordinates in scripts. I have one object (an overlay) that would really benefit from moving 1 real pixel at a time. Is there any way to do that? I'd rather not convert the entire game to high res, as that would take several days.

GarageGothic

If it's a graphical overlay (or if text, rendered onto a DynamicSprite and displayed as a graphical overlay), you could create an alternate DynamicSprite padded with an extra row of pixels on the left/top side (depending on which direction it will be moving) and simply substitute that sprite (effectively destroying and creating a new Overlay) every time the Overlay it's supposed to be "between pixels". You would use DrawingSurface.UseHighResCoordinates before drawing the original overlay sprite to the alternate sprite surface at a 1 (hi-res) pixel offset.

EnterTheStory (aka tolworthy)

That's a good idea. Thanks. It's for a snow animation (where the sideways jittering is very noticeable when the flakes jump two pixels at a time). Presumably there would be memory implications if the fifteen separate full screen overlays suddenly became 30?

monkey0506

Well you can only have 20 simultaneous screen overlays, so yes, there would be an issue there. :P

You can use the DrawingSurface functions to merge together those overlays though (drawing them all to a single DynamicSprite then using it to create a single overlay).

SMF spam blocked by CleanTalk