playMaker

Author Topic: 2d Parallax Background  (Read 1585 times)

hoyoyo80

  • Full Member
  • ***
  • Posts: 136
2d Parallax Background
« on: September 26, 2020, 09:18:42 AM »
Hi all,

Im digging around the forum but cannot find the answer.

I want to achieve 2d parallax scrolling in unity using Playmaker. Currently im using quad and changing the texture offset but it dont really work.

Can someone help me?

Thanks

rechronicle

  • Full Member
  • ***
  • Posts: 119
  • Mystvaldia
    • Indie RPG Creator
Re: 2d Parallax Background
« Reply #1 on: September 26, 2020, 01:40:31 PM »
I know two ways to do it.
Scroll them by events. The further behind the background, the slower it scrolls based on camera position. So when you move to the right, the mid ground will scroll faster to the left than the one at the background, creating a parallax effect.

Or just use perspective camera, and it will create parallax effect by default. Just place them accordingly by distance.

Hope it helps. :)

hoyoyo80

  • Full Member
  • ***
  • Posts: 136
Re: 2d Parallax Background
« Reply #2 on: September 27, 2020, 04:19:01 AM »
Thanks for your suggestion. I tried the perspective view it really work but i face a problem where sometime thing that should be behind move to front until i reach there.

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: 2d Parallax Background
« Reply #3 on: September 27, 2020, 04:43:54 AM »
Don’t reinvent the wheel there ;) I would grab a script that does this, which should be dime a dozen, unless there is really some special feature; or you want to learn how to do it.

hoyoyo80

  • Full Member
  • ***
  • Posts: 136
Re: 2d Parallax Background
« Reply #4 on: September 27, 2020, 07:32:25 AM »
Thanks all. Not reinventing the wheel bro,cannot find the script :P

Ok, i found the solution by altering texture offset of a quad. The reason it dont work before is, somewhere in the float compare action,i filled wrong value in float 2 and tolerance:P

My method:
1.Use a quad,texture it with seamless background texture
2.Align to camera,and move with camera
3.When player move, change the texture offset depending on the movement direction.

Thanks All, Love U :-*
« Last Edit: September 27, 2020, 07:34:24 AM by hoyoyo80 »