playMaker

Author Topic: Endless Scrolling with a twist!  (Read 560 times)

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 845
    • View Profile
    • Fat Pug Studio
Endless Scrolling with a twist!
« on: May 17, 2017, 04:52:06 AM »
Hello,

i did a 2D scrolling background system, but it needs an upgrade, and i need your help! :)

Here's a neat little graphic to help with explaining:



There are 5 background images of identican dimensions seamlessly connected to one another, first two (Empty Stars 1 and Empty Stars 2) and the last two (Empty Stars 3 and Empty Stars 4) are empty starfield.

The player starts the game on the Empty Stars 2 field, and the background scrolls left to give an illusion of moving right. As the player moves through the level and passes on to the Empty Stars 3 and Empty Stars 4, only those two should loop until the end of the level occurs.

I though of doing it by simply activating the FSM on Empty Stars 3 when it becomes visibile and checking the isVisible state of it. When it's not visible anymore, it relocates by double its width towards right. Same goes for Empty Stars 4.

When the level ends, the hyperspeed state occurs in which the background movement speed increases (and continuously loops through Empty Stars 3 and Empty Stars 4 for an effect of speeding through space), some effects kick in and the screen fades to white.

At that moment, all the background elements are relocated to their original positions so the seamless background loop can be continued. The Full Background image is changed to present another level. During the slowdown to normal speed, Empty Stars 1 and Empty Stars 2 are looped the same way as Empty Stars 3 and Empty Stars 4 when entering hyperspace to avoid looping the Full Background Image. When the speed settles to normal, looping is off, and continues it's normal flow towards the end images. The FSM's for movement, waiting to be seen and relocation are reset and wait for them to be triggered again.

Actually, i wanted to ask the proper way of doing this since i only had a simple variant of it, but as i typed i got it all together lol. But be free to suggest a better solution if you have it.
« Last Edit: May 17, 2017, 04:55:56 AM by krmko »

FritsLyn

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: Endless Scrolling with a twist!
« Reply #1 on: May 17, 2017, 02:26:54 PM »
I really want to answer you, but it appears to me at least that you are giving a ton of information, and it is hard to grasp what the actual question is.

Can you ask the actual question in one line?
(Then I can look at the other info and get that if needed)

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 845
    • View Profile
    • Fat Pug Studio
Re: Endless Scrolling with a twist!
« Reply #2 on: May 18, 2017, 03:59:23 AM »
Sure thing, two questions:

1) Is there a better way to make an illusion of endless scrolling except repositioning the past background block in front of the next one when it's no longer visible?

2) What should i use to instantly move the background object, for example, 5 units right (its width) on the x axis, not to a defined coordinate by using set position. I'm not sure set position local will work if it's not parented.
« Last Edit: May 18, 2017, 08:01:53 AM by krmko »