Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Vincent on Sat 05/11/2022 20:51:20

Title: Visual background effect
Post by: Vincent on Sat 05/11/2022 20:51:20
Hello to all agser.
Today I was trying to make an effect for a room (640x400) to make it move slightly to the left and right side (as if the room was moving/floating) to accomplish this I have done something like this by using the tween module:

DynamicSprite* sprite; //outside function
//...
sprite = DynamicSprite.CreateFromBackground();
gScreenEffect.BackgroundGraphic = sprite.Graphic;
gScreenEffect.TweenX(2.5, gScreenEffect.X+5, eEaseLinearTween, eReverseRepeatTween);

This is working like I had it in mind, the problem now is to make the same effect for a scrolling room (1280x400) how I accomplish something like this? Cause I am facing few issues like moving the gui with same camera position and to keep the 'floating' effect at the same time, how do you achieve something like this?
Title: Re: Visual background effect
Post by: eri0o on Mon 07/11/2022 10:44:14
Any reason for using a gui instead of a room object? The room object, would make the camera stuff something that takes care itself.
Title: Re: Visual background effect
Post by: glurex on Mon 07/11/2022 21:08:16
Same as eri0o. You have to place an object (check the baseline and the clickeable variable) in the left bottom corner of your room and, following your previous script, only:

DynamicSprite* sprite; //outside function too
//...

sprite = DynamicSprite.CreateFromBackground();
  oBackground.Graphic = sprite.Graphic;
 oBackground.TweenX(2.5, oBackground.X+5, eEaseLinearTween, eReverseRepeatTween);

}

That will work with scrolling rooms too
Title: Re: Visual background effect
Post by: Vincent on Thu 10/11/2022 23:23:35
Thanks guys only after few minutes of doing the post I had the same thought in fact using an object I solved the problem, thanks again for replying