Visual background effect

Started by Vincent, Sat 05/11/2022 20:51:20

Previous topic - Next topic

Vincent

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:

Code: ags
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?

eri0o

Any reason for using a gui instead of a room object? The room object, would make the camera stuff something that takes care itself.

glurex

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:

Code: ags
 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

Vincent

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

SMF spam blocked by CleanTalk