playMaker

Author Topic: Looping Background Question  (Read 335 times)

nhe1

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Looping Background Question
« on: April 27, 2018, 09:50:18 AM »
So I am trying to create this 2D background scene similar to Flappy Bird where in the background loops infinitely. Can someone kindly explain why my approach doesn't seem to work.

1. I store the initial spawn point of the background in a Vector3 variable in world space.
2. Once the Background enters the trigger it stores it as a game object variable.
3. I move it to initial spawn point using "Translate".

Thing is, it translates the object weirdly into the scene. I did check the initial stored coordinate during runtime and it is correct. I tried using Move Object and it works perfectly however when using translate using the stored coordinate I cant seem to find a way around it.

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 735
    • View Profile
    • Fat Pug Studio
Re: Looping Background Question
« Reply #1 on: April 27, 2018, 02:18:37 PM »
Use two same sprites for background. Put them one next to another horizontaly. #1 has spawn position A, #2 has spawn position B. Translate them both at same speed. When #1 reaches position C (let's presume it's the point left of the screen if you are "moving" right) use set position to move it to position A. Repeat with #2.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3252
    • View Profile
    • jinxtergames
Re: Looping Background Question
« Reply #2 on: May 01, 2018, 03:59:26 AM »
Hi,
There are multiple ways to achieve this.
I am making a tutorial for this and hope to upload to Youtube by the end of this week.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3252
    • View Profile
    • jinxtergames
Re: Looping Background Question
« Reply #3 on: May 18, 2018, 06:29:34 AM »
Hi.
Sorry i forgot to upload this, here is the tutorial video :