#Can't get Parallax to work

63 messages · Page 1 of 1 (latest)

glacial geyser
#

I've tried following a few tutorials and the documentation and I can't get parallax to work. I've tried both the parallaxBackground nodes and the newer Parallax2D nodes. It seems (from tutorials I've found), that all you really need to do is add a parallaxBackground with a parallaxLayer with a sprite2d (for each parallax layer), then just set the mirroring of the layer to twice that of the length of the sprite2d texture, and it should basically work.

Instead I get some very weird behaviour that I cannot for the life of me debug. Anyone have an idea as to what's going on?

spark crag
#

Make sure you position your background sprite so that it's top left corner is at 0,0

glacial geyser
#

you mean like this?

frigid valley
#

I am not sure if that changed on 4.3, but the texture needs to be wider than the viewport

glacial geyser
#

I can probably scale it? Then set the mirroring to account for that? I am also on the newest build so I can mess around with the parallax2d

#

for now I'm trying to zoom in my camera and I still can't quite get it working

frigid valley
#

I am not sure if scale works. You could just edit the image

#

also scale will messup your pixel art

glacial geyser
#

zoomed in. Good to know about scaling! Not too important now as I'm just familiarizing myself with the engine with some free itch.io assets

frigid valley
#

I think the problem here is the position of your assets

#

although I am not sure if that should matter

glacial geyser
#

https://www.youtube.com/watch?v=f8z4x6R7OSM&t=35s

^^ This here makes it look dead simple. I can't imagine what i'm doing wrong

In this Godot Engine tutorial, I show you how to create a Parallax Scrolling effect in Godot engine.

Download the setup here: https://github.com/bitbrain/godot-tutorials
Direct download link: https://github.com/bitbrain/godot-tutorials/archive/main.zip

👉 Join my Discord now! https://discord.gg/sJjsksEwDq

⌚ Timestamps

0:00 Intro
0:17 Setup Pa...

▶ Play video
#

mind you it's an older version

spark crag
#

Have you changed the position of your parallax layer node?

glacial geyser
#

it's at 0,0

spark crag
#

Oh you have camera zoom? That's probably the issue

#

I don't think the old parallax works with camera zoom

#

Actually... I don't think your mirror value matches the size of your background, does it?

glacial geyser
#

it did at one point, one of my screenshots has it as double as I was messing around

#

turning off the zoom, and I think you're onto somethnig

#

but I mean... that seems kinda weird, since the default camera is pretty darn big

spark crag
#

You shouldn't use camera zoom if you're trying to make your pixel art game bigger

#

Use the viewport size and the stretch mode settings

#

I think the new Parallax2D node might support camera zoom though, and you should be using that instead anyway, since you're on 4.3

glacial geyser
#

sure let's try it out

spark crag
#

Yeah, the old one doesn't support more than one mirror, so your screen is too big for your background

glacial geyser
#

so I'm wondering why the background is so far behind the camera

#

ok so setting the x offset to fit seems to get things working

#

I can hopefully figure some things out from here

#

thanks a ton!

glacial geyser
#

ok I have a good effect going. Now I just need it to follow the camera on the y-axis. maybe I'm going about this wrong, but I'd want the y-axis to not repeat (as this texture isn't built for that), and to remain in the viewport. Maybe easier to describe with another clip:

#

that seems to move it off the camera entirely

#

let's give that a shot

#

seems to be the same on beta2

#

what's the best way to do that? just zip the folder and send it here?

#

yea I thought that was weird

#

I have the sprites positions offset too

#

which feels wrong

#

ok, so why is my image still not having it's top left at the origin?

#

ok, everything seems to be working now after unzipping the project. I'm not sure what you did differently though

#

ah ok, so with the camera it's better practice to do that rather than zoom? pretty sure the brackeys tutorial used zoom, which is why I defaulted to that

#

makes sense

#

so it's better for coding in a certain effect then

#

and the project settings is the default

#

good to know

#

ok, I think I can mark this thread as resolved. Thanks for your time and help!

#

yep I think I did that already

#

oh yep, I can see the repeat now when playing

#

I have a region to the bottom right there where the texture ends. Is that what you're referring to? (This is after setting the repeat -> enabled). It goes away if I set the repeat on the parallax2d to 3

#

yea I guess these particular assets I found aren't quite big enough

#

I assume I can leave the y repeat to 0 as these textures aren't made for repeating vertically?

#

setting the repeat size to what you have gives me this effect

#

ok, that gets everything working

#

thanks again! gdsalute

glacial geyser
#

nvm, stretch -> canvasitems was what I was missing