Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: EnterTheStory (aka tolworthy) on Wed 24/03/2010 17:43:40

Title: can an overlay move 1 pixel at a time, if using low res coordinates?
Post by: EnterTheStory (aka tolworthy) on Wed 24/03/2010 17:43:40
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.
Title: Re: can an overlay move 1 pixel at a time, if using low res coordinates?
Post by: GarageGothic on Wed 24/03/2010 18:10:35
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.
Title: Re: can an overlay move 1 pixel at a time, if using low res coordinates?
Post by: EnterTheStory (aka tolworthy) on Thu 25/03/2010 00:43:33
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?
Title: Re: can an overlay move 1 pixel at a time, if using low res coordinates?
Post by: monkey0506 on Thu 25/03/2010 01:32:04
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).