Parallax Scrolling

Blob

  • *
  • Posts: 721
I've heard this was suggested before, but the fact that Stencyl can't have scrolling backgrounds that move in conjunction with the character (parallax scrolling) is a pretty irritating lack of a feature considering it's such a common feature in games.

I worked a fair amount to make the backgrounds in my game loopable, but it's not much use unless they're going to auto-scroll, and they don't look all that great stationary.
By chance could we expect this feature to ever be implemented?

~ Blob

EDIT: renamed to parallax scrolling.

« Last Edit: March 31, 2011, 06:54:54 pm by Blob »

irock

  • *
  • Posts: 2891
To make things clear, I believe Blob's suggesting that you allow users to have a parallax background that loops a set number of times or be able to set the movement speed of a repeating background in relation to the camera movement.

Right now the parallax background's movement speed basically relates to the size of the background size, so a small scene would have a fast moving parallax background and a large scene would have a slow moving one. You have to manually create different backgrounds that are larger than the screen for each scene in order to achieve a background that moves at the same speed in each scene.

Legendary Hoamaru

  • *
  • Posts: 1088
If permitted, I could try it out next week.

Jon

  • *
  • Posts: 17524
I permit you to look into this.

Darkhog

  • Posts: 1243
Also it would be nice if it'd be possible to make layers scrolling in parallax (so we can make easily parallaxes using tiles).

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

Darkhog

  • Posts: 1243
Well? I think I found solution which would be more userfriendly than current based on size of images. I made up few rules which make it easy to use.

1. In bg proporties checkbox for autoscroll shouldn't disable/enable fields for entering the speed and now:
2. If speed is set to zero bg is moving at camera speed.
3. Speed is measured in pixels/frame, so if it is set to 14 it will move at camera speed plus 14 pixels every frame.
4. If image of background is bigger than scene and scrolling speed is different than 0 (negative values moves in opposite direction) at the end of scene it will be cut out.
5. If image of background is smaller than scene after reaching end of image it would be repeated (if xspeed or yspeed is set to 0 it won't repeat in that direction, will stay at upper left corner as it is now).
6. Points 2-5 aren't applicable if autoscroll is selected.

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

Legendary Hoamaru

  • *
  • Posts: 1088
I won't me able to do this until May, after 4 of my classes end.

Darkhog

  • Posts: 1243
OK. But I had to share these ideas.

Anyway I hope you'll graduate, Mike.

There are no impossible things. There is only lack of skills.
Don't click this if your computer has less than 641 kilobytes of RAM.
Stencyl stencyling stencylish stencylers :D

gmvasco

  • Posts: 44
Any news on this? I would like easy parallax scrolling too.

Luxon5

  • Posts: 12
Could you use a large actor sprite as the background instead? You could set the speed of the background actor to be going the opposite direction and at a % of the speed of the camera. The actor would have to be behind everything else in the scene. I'm not sure how well that will work with tiles... can the scene editor put an actor behind the tiles but have other actors in front/same depth as those tiles?

Hectate

  • *
  • Posts: 4643
Yes, just use layers to decide what order you want everything.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

gmvasco

  • Posts: 44
Could you use a large actor sprite as the background instead? You could set the speed of the background actor to be going the opposite direction and at a % of the speed of the camera. The actor would have to be behind everything else in the scene.(...)

Brilliant!
I'll make a behavior for this then.


gmvasco

  • Posts: 44
Done. The "Parallax scrolling movement" behavior is on forge now. This is a working solution for some games, but if your background is big, you will take a performance hit. Let me know what you think.

Jon

  • *
  • Posts: 17524
Thanks. I've featured the behavior.

Blob

  • *
  • Posts: 721
The behavior is a nice substitute, but it would definitely be more efficient if there was actual support for this. This forces me to make several more layers which throws off some of my actor spawning, and it's another thing slowing the fps. So I hope the effort for support continues.

~ Blob