Parallax Background with 1 Line of Code! - Godot Engine 4.0 Tutorial 2D

preview_player
Показать описание
Learn how to get started in your journey to game dev! I hope this video helps you get started on this long but fun journey you plan on taking!

Thanks for watching my video!

Project Assets:

Download Godot 4.0:

#godotengine #godot #gamedev #gamedevelopment #parallax #parallaxeffect
Рекомендации по теме
Комментарии
Автор

Due to perspective, the planets farthest away from you should appear to be moving the slowest if all the celestial bodies are moving at the same relative speed

mikecl
Автор

you are the goat! you always have the best tutorials

kosm
Автор

Thank you for explaining this so simply, I was struggling with chatgpt and other sources they did not explain it as well, thank you <3

Scrackles
Автор

thanks so much i use this for all my game now thanks so much

SixGroundsStudios
Автор

help ! If I add camera2D node to the scene the parallax background stops scrolling how can I fix this ?

deeraghoogames
Автор

if the X axis is static, this works great. However, I can't seem to find a way to fix the Y when my character jumps and that's quite annoying

danobra
Автор

Hey just letting you know this helped a lot. Thanks! Mike from TKFY

wordofmike
Автор

Thankyou! I really need this. Hopefully this will work with Godot 4.2.2.

vaughanmacegan
Автор

if you need to export to use other scene (ex: world.tscn)
change code in script bg.tscn below
scroll_offset.x to scroll_base_offset.x

MeteorVIIx
Автор

7::18 this build in script is not on the right side at my code. The layers aren t moving or only for 1 second. So not working for me :(

tutorial
Автор

scroll_offset didn't work for me. I had to use scoll_base_offset instead.

oggmonster
Автор

What were your project settings? When I first launched the game with you, my background was much smaller even though the BG size matched yours.

starcitizenbot
Автор

I feel like I've tried everything, and yet it seems that scroll_offset as well as scroll_base_offset only give me this error for some reason: Identifier "scroll_base_offset" not declared in the current scope.

I guess I need to find a more complicated alternative. I even tried -= 40*delta" but the game just crashes.

Srcsqwrn
Автор

How do you change parallax backgrounds? I've been trying to delete/add backgrounds like objects and the new background just stutters. Is there a correct way to do this? I haven't seen a single bit of information on this.

Sportsfan
Автор

This works for me as my character is stationary, like flappy bird, for example. However, I need to make the parallax bg follow the player on the y axis, but I can't figure out how to do that 🤔

juliangutierrez
Автор

I implemented this in the background of my platformer, but the scrollSpeed variable had no effect on the scrolling whatsoever. I removed the code, and it works just the same as it did with it. However, it does not scroll by itself, only when the player and camera is moving

FunFindsYT
Автор

I appreciate the video. So, how do you do this for a scene with player movement? As in, how do I make my BG do parallax scrolling when my player moves along the main scene?

danielbarlow
Автор

Thanks for the video but I also face issues, the parallax is not behaving the same as you: my "planets" only repeat once and the scale has no effect at all. FYI, I'm trying to build a game for the web. Thanks a lot for your help.

jfurmann
Автор

great video but it doesent look natural becouse things closer to you will move faster away from your perspective than things that are further away, so you should make things that are far away move slowly and things that are closer faster becouse thats how it works in real life and that makes the effect seem realistic.

MrStarlightt
Автор

Hey, thats cool. But in my code (Godot 4.0) it works only with ONE Sprite2D (like "moon.png") per ParallaxLayer. Adding more Sprites causes them to dissapear on different positions on the screen instead of leaving the screen to the bottom (I used scroll_offset.y) and than coming back not from the top but from the position where they first started. I thought I did everything like in your video. What am I doing wrong?

gruentjes