0 votes

hi newbie here,

i have this scene

Node - as main node

kinematicbody2d - as a child of node, it have animatedsprite, collisionshape2d and camera2d nodes

parallaxbackground - as a child of node, it have parallaxlayers and sprites nodes

watching some tuts i have a level where player can move across, and background does parallax and repeat repeat itself, so far so good.

but i want to add a new parallax layer, lets call it Clouds, as it name sugest its texture gonna be some clouds, what i want to do is that this layer move by itself as if wind where moving the clouds; without loosing parallax layer properties, moving with camera and repeating by itself

how can i achieve this effect?

when i manually tweak on motion section, offset subsection on parallaxlayer node it resembles what i want to achieve, but i dunno how to script it

Vector2 motion_offset

setmotionoffset(value) setter

getmotionoffset() getter

The ParallaxLayer's offset relative to the parent ParallaxBackground's ParallaxBackground.scroll_offset.

asked Jul 27, 2018 in Engine by lofi (36 points)

1 Answer

+2 votes

Nevermind, i find it for myself; just in case anyone is interested

script inside parallaxlayer - setmotionoffset(Vector2()) does the trick

answered Jul 28, 2018 by lofi (36 points)

Hey! did you achieve this in process(delta)? if not can you supply the copy-pasted code?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.