Help Scrolling Background

Lately I have had trouble doing a specific task. I have tried to have a background image scroll slowly as the game goes, but when the image comes to the end, I don't know how I'll repeat it. Mostly what I need to happen is when the image reaches the end, have the image loop as if the beginning of the background image was taped to the end to form a continuous loop. I have tried spawning a new instance of the background when it gets to a certain position, but that won't seem to work. :'( Does anyone know of an algorithm or logic to make this happen?

Comments

  • LovejoyLovejoy Member Posts: 2,078
    edited October 2014

    @757MinecraftCrazy said:
    Lately I have had trouble doing a specific task. I have tried to have a background image scroll slowly as the game goes, but when the image comes to the end, I don't know how I'll repeat it. Mostly what I need to happen is when the image reaches the end, have the image loop as if the beginning of the background image was taped to the end to form a continuous loop. I have tried spawning a new instance of the background when it gets to a certain position, but that won't seem to work. :'( Does anyone know of an algorithm or logic to make this happen?

    Try checking wrap x or wrap y in the scene attributes.

    Edit:

    If you only want one actor to wrap then you can make a rule

    When attribute self.position.x < 0-(self.size.width/2)

    Change attribute self.position.x to 768+(self.size.width/2)

    --

    Change the 0 and 768 to whatever values you want it to wrap.

    Fortuna Infortuna Forti Una

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    There is a scrolling background tutorial here, if you want to check it out:

Sign In or Register to comment.