Jump to content

Parallax Scrolling Solution


Ninjadoodle
 Share

Recommended Posts

Hi guys

 

I've just started playing with the camera in Panda and its awesome!

 

Has anybody got any ideas whether it's possible to do parallax scrolling or how it should be approached if a workaround is needed.

 

I have some really long-winded ideas, but trying to see if there might be an easier option.

 

Thank you heaps in advance!!

Link to comment
Share on other sites

Ok, here is what I've come up with ...

 

Let's say you're making a horizontal scroller.

 

Make two containers -> bg and fg, then attach you camera to fg and make it follow a sprite in the same container.

 

Then, inside the update function ...

 

update: function() {        this._super();    bg.x = fg.x * 0.75;},

This makes the background layer scroll at 75% speed of the foreground layer.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...