How do YOU achieve smooth scrolling?
olster1
Member Posts: 396
A lot of games have some sort of scrolling background. With game salad there are many ways to achieve this. A problem a lot of people, including myself, seem to face is the scrolling might sometimes seem jittery. So how do you achieve a smooth scrolling background? Well I ended up using quantumsheep's suggestion.
This thread can be used to share how you achieve smooth scrolling and to help out the others int he community.
thanks!
quantumsheep said:Another suggestion is from shaz who posted this.
You can make your background like this:
Say it's a starfield. Actor size doesn't matter - when you place it in your scene, just stretch it so it fills the screen.
This actor will contain the following
A movement behaviour (say direction 180, speed 90 if you're doing a side scroller).
Then underneath this a single rule:
When
Attribute self.position.X < - self.Size.Width /2
Change attribute self.position.X to self.Position.X + self.Size.Width + game.Display Size.Width
Then, put the actor in your scene as described above, and add a second instance of the actor next to it of equal size.
This will allow smooth scrolling, and will mean you can get rid of the wrap.
Hope that helps
This thread can be used to share how you achieve smooth scrolling and to help out the others int he community.
thanks!
Comments
It was one of the first things I wanted to know how to do, and has served me well across multiple games!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io