How to create a continuous moving background one after the other?

famekraftsfamekrafts Member, BASIC Posts: 834

I have set up my background to scroll down, of a map size of 768 x 2048. Once the map reached the top edge of iPad screen another, another background should follow it. The size of the screen is 768 x 1024 iPad portrait.

But instead of following it is appearing suddenly in front of it before the background moves completely out of the screen. I am sure it is somewhere related to the pixel dimensions and position.

Can anyone tell how to calculate the position of the second background when spawned?

This is how I have set up my rules:

Image and video hosting by TinyPic

I think I have posted in the wrong section, so if it is possible, the moderator can move it into the right forum section.

Comments

  • bob loblawbob loblaw Member, PRO Posts: 793

    not sure exactly what you’re saying but i’ll give it a go:

    if you’re doing just a moving background on its own, instead of one continuous background image, try splitting it (making sure your scene is the size of both images combined. make sure wrap y is checked in your scene attributes. as long as you have the same y motion in each image, they should scroll through.

    otherwise, if you have set logic to reset the image position when it passes through the scene camera, split images, as above, but have a condition in each that says when the y value =< self.size.height/2 change y position to 1024+ self.size.height/2

  • famekraftsfamekrafts Member, BASIC Posts: 834

    @bob loblaw said:
    not sure exactly what you’re saying but i’ll give it a go:

    if you’re doing just a moving background on its own, instead of one continuous background image, try splitting it (making sure your scene is the size of both images combined. make sure wrap y is checked in your scene attributes. as long as you have the same y motion in each image, they should scroll through.

    otherwise, if you have set logic to reset the image position when it passes through the scene camera, split images, as above, but have a condition in each that says when the y value =< self.size.height/2 change y position to 1024+ self.size.height/2

    Hey Bob

    Thanks.

    I am not going to use wrap y because I need to control the speed later (increase or decrease) and there are different backgrounds which are seamless and not just one.

    It is a racing endless game. Anyone can give a link of such a template?

    Right now I have made the image 768 x 2048 while the scene size is 768 x 1024.

    I have made it the double size of the scene, but I will try your idea as well, making it half of the scene instead of double.

  • AlkaPPAlkaPP Member, PRO Posts: 194

    What exactly are you trying to do? You want to move images one after another to create endless background? And be able to adjust the moving speed?

    My Gamesalad Games On App Store:

    Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1

  • bob loblawbob loblaw Member, PRO Posts: 793
    edited May 2019

    @famekrafts said:

    @bob loblaw said:
    not sure exactly what you’re saying but i’ll give it a go:

    if you’re doing just a moving background on its own, instead of one continuous background image, try splitting it (making sure your scene is the size of both images combined. make sure wrap y is checked in your scene attributes. as long as you have the same y motion in each image, they should scroll through.

    otherwise, if you have set logic to reset the image position when it passes through the scene camera, split images, as above, but have a condition in each that says when the y value =< self.size.height/2 change y position to 1024+ self.size.height/2

    Hey Bob

    Thanks.

    I am not going to use wrap y because I need to control the speed later (increase or decrease) and there are different backgrounds which are seamless and not just one.

    It is a racing endless game. Anyone can give a link of such a template?

    Right now I have made the image 768 x 2048 while the scene size is 768 x 1024.

    I have made it the double size of the scene, but I will try your idea as well, making it half of the scene instead of double.

    you could use two background actors with a variable in each called something like 'whichImage' - that you would have a change behaviour set to 1. when each of the images reaches position y-self.size.height/2, increase the 'whichImage' attribute by 1. then within each actor, you could have the logic to say, if 'whichImage' = 1, change image to ...., and so on, for each value.

    have a look at the attached as an example of an endless scrolling background with parallax effect. you can easily speed up/slow down the movement based on score/time or whatever.

  • famekraftsfamekrafts Member, BASIC Posts: 834

    @AlkaPP said:
    What exactly are you trying to do? You want to move images one after another to create endless background? And be able to adjust the moving speed?

    Yes something like that.

  • famekraftsfamekrafts Member, BASIC Posts: 834

    you could use two background actors with a variable in each called something like 'whichImage' - that you would have a change behaviour set to 1. when each of the images reaches position y-self.size.height/2, increase the 'whichImage' attribute by 1. then within each actor, you could have the logic to say, if 'whichImage' = 1, change image to ...., and so on, for each value.

    have a look at the attached as an example of an endless scrolling background with parallax effect. you can easily speed up/slow down the movement based on score/time or whatever.

    I will give this a try and let you know.

  • famekraftsfamekrafts Member, BASIC Posts: 834

    @famekrafts said:

    you could use two background actors with a variable in each called something like 'whichImage' - that you would have a change behaviour set to 1. when each of the images reaches position y-self.size.height/2, increase the 'whichImage' attribute by 1. then within each actor, you could have the logic to say, if 'whichImage' = 1, change image to ...., and so on, for each value.

    have a look at the attached as an example of an endless scrolling background with parallax effect. you can easily speed up/slow down the movement based on score/time or whatever.

    I will give this a try and let you know.

    I have used your sample parallax background technique and using wrap y, I managed to make one background move infinitely using wrap y.

    For some reason, the spawning actor doesn't seem to work with my game salad properly or I am doing something wrong. I have windows creator.

    So one background is moving infinitely, how do I add more backgrounds to the mix so that about 3-4 backgrounds keep appearing randomly although they all should appear seamless.

    Should I use timer and change image option? say after 20 secs when the background has crossed the scene area, the image replaces with another actor.

  • bob loblawbob loblaw Member, PRO Posts: 793

    @famekrafts said:

    @famekrafts said:

    you could use two background actors with a variable in each called something like 'whichImage' - that you would have a change behaviour set to 1. when each of the images reaches position y-self.size.height/2, increase the 'whichImage' attribute by 1. then within each actor, you could have the logic to say, if 'whichImage' = 1, change image to ...., and so on, for each value.

    have a look at the attached as an example of an endless scrolling background with parallax effect. you can easily speed up/slow down the movement based on score/time or whatever.

    I will give this a try and let you know.

    I have used your sample parallax background technique and using wrap y, I managed to make one background move infinitely using wrap y.

    For some reason, the spawning actor doesn't seem to work with my game salad properly or I am doing something wrong. I have windows creator.

    So one background is moving infinitely, how do I add more backgrounds to the mix so that about 3-4 backgrounds keep appearing randomly although they all should appear seamless.

    Should I use timer and change image option? say after 20 secs when the background has crossed the scene area, the image replaces with another actor.

    within each of the two backgrounds, create a self attribute that starts at 1.
    use a condition within the actor that says when the y position is at a certain point, change the self attribute mentioned above to itself+1.
    then you’ll need to create a bunch of conditions wirhin the background actor that say if the attribute = 1, change image to...., if attribute = 2, change image to ...., etc for each image. if you want the image to be random, you’ll need to use the random number function, rather than the +1 thing i described above.

  • famekraftsfamekrafts Member, BASIC Posts: 834

    @bob loblaw said:

    within each of the two backgrounds, create a self attribute that starts at 1.
    use a condition within the actor that says when the y position is at a certain point, change the self attribute mentioned above to itself+1.
    then you’ll need to create a bunch of conditions wirhin the background actor that say if the attribute = 1, change image to...., if attribute = 2, change image to ...., etc for each image. if you want the image to be random, you’ll need to use the random number function, rather than the +1 thing i described above.

    Cool. I will check this out next.

  • famekraftsfamekrafts Member, BASIC Posts: 834

    Instead of changing image, I have tried creating a huge background of 6144 height.

    But now it is not warping properly. Because of the scene size is 1024 it is wrapping every time the image crosses y=0. Thus image fluctuates and changes to a different part of the background, without scrolling down completely.

    What should I do about this?

    I will try using different backgrounds but I believe it will be a pain in the neck to make them work in tandem together without getting the same flickering problem I have now.

  • famekraftsfamekrafts Member, BASIC Posts: 834

    Here is how it looks

  • famekraftsfamekrafts Member, BASIC Posts: 834

    I have tried changing the scene height to 6144 and now it works fine but only till the second part of the background, after that, it just vanishes as in the next video

  • famekraftsfamekrafts Member, BASIC Posts: 834

    I have tried 4096 as well as 3072 height as well. None is wrapping properly, Only a 2048 size is wrapping properly.

  • AlkaPPAlkaPP Member, PRO Posts: 194

    When you use more than 1 image and change the scene original size, wrapping will be very complicated.

    Try to use the original size 1024. Use interpolate behavior to move the actor. You only need 2 actors on the scene using the same rule.

    The first actor y position should be at 0, and the other one is 1024. When it move off the scene I believe is -1024 then put it back to the top 1024 then have a rule to change the image when it’s at 1024.

    I’ll make a demo project for you when I got home.

    My Gamesalad Games On App Store:

    Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1

  • famekraftsfamekrafts Member, BASIC Posts: 834
    edited May 2019

    @AlkaPP said:
    When you use more than 1 image and change the scene original size, wrapping will be very complicated.

    Try to use the original size 1024. Use interpolate behavior to move the actor. You only need 2 actors on the scene using the same rule.

    The first actor y position should be at 0, and the other one is 1024. When it move off the scene I believe is -1024 then put it back to the top 1024 then have a rule to change the image when it’s at 1024.

    I’ll make a demo project for you when I got home.

    Thanks. I am stuck at this, as you mentioned it is complicated. Will be waiting.

    I have added a rule, when touch is inside only then it moves.

  • AlkaPPAlkaPP Member, PRO Posts: 194

    @famekrafts here's the demo. Built with Mac so you might need to change the extension to use on Windows. Might not be exactly what you need but hopefully will give some ideas.

    My Gamesalad Games On App Store:

    Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1

  • RedRoboRedRobo Member, PRO Posts: 680

    @gamesmold revealed his technique for Spooky Hooves here:
    https://forums.gamesalad.com/discussion/30862/spooky-hoofs-addictive-coach-ride-by-gamesmold/p4
    A few gems in there. One of the GameSalad legends...

  • famekraftsfamekrafts Member, BASIC Posts: 834

    @strag said:
    @gamesmold revealed his technique for Spooky Hooves here:
    https://forums.gamesalad.com/discussion/30862/spooky-hoofs-addictive-coach-ride-by-gamesmold/p4
    A few gems in there. One of the GameSalad legends...

    It makes me feel how much I do not know about Gamesalad. Lol. Good decision I went with Gamesalad and not other engines. I have tried all of them from game maker to Unreal. Gamesalad has a history, but what about recent ventures. This was in 2011. Any Game recently launched and reached top 10 apps in-game store?

  • famekraftsfamekrafts Member, BASIC Posts: 834

    I really liked @Gamesmold approach, using the camera and shifting the backgrounds instead to give it a look of an endless runner. But I am creating a racing game and speed needs to vary in short bursts. This technique might not work. Quite frankly there are no real high-end racing games created by game salad.

    I always take the impossible head on and then get stuck. I think I should change my project to a simple non-moving background game now before it is too late.

    @AlkaPP I have not checked your project yet, but I think it will lead to the same problem, using interpolate and increasing the speed later might clash.

  • RedRoboRedRobo Member, PRO Posts: 680

    @famekrafts said:

    @strag said:
    @gamesmold revealed his technique for Spooky Hooves here:
    https://forums.gamesalad.com/discussion/30862/spooky-hoofs-addictive-coach-ride-by-gamesmold/p4
    A few gems in there. One of the GameSalad legends...

    It makes me feel how much I do not know about Gamesalad. Lol. Good decision I went with Gamesalad and not other engines. I have tried all of them from game maker to Unreal. Gamesalad has a history, but what about recent ventures. This was in 2011. Any Game recently launched and reached top 10 apps in-game store?

    Not heard of anything recently although I'm not on the forum very regularly.
    I think with GameSalad, although it is capable of complex games I think project that can be completed relatively quickly is the way to go. I couldn't bear to spend 2 years making a game only to have the desktop version discontinued or some other major change that would break it.

  • famekraftsfamekrafts Member, BASIC Posts: 834
    edited May 2019

    @strag said:

    @famekrafts said:

    @strag said:
    @gamesmold revealed his technique for Spooky Hooves here:
    https://forums.gamesalad.com/discussion/30862/spooky-hoofs-addictive-coach-ride-by-gamesmold/p4
    A few gems in there. One of the GameSalad legends...

    It makes me feel how much I do not know about Gamesalad. Lol. Good decision I went with Gamesalad and not other engines. I have tried all of them from game maker to Unreal. Gamesalad has a history, but what about recent ventures. This was in 2011. Any Game recently launched and reached top 10 apps in-game store?

    Not heard of anything recently although I'm not on the forum very regularly.
    I think with GameSalad, although it is capable of complex games I think project that can be completed relatively quickly is the way to go. I couldn't bear to spend 2 years making a game only to have the desktop version discontinued or some other major change that would break it.

    I am working all alone, so it will take some time, as I am documenting the whole process in a book. I am a designer, so documenting the designing process as well. Not going to take more than 3 months I believe. Writing every day will make sure the game work doesn't stop.

    So those who are not good with designing can actually learn how to create their own game sprites and backgrounds.

    The only issue is like this thread, getting stuck with something which game engine cannot handle.

    Has anyone created any RPG with Game Salad?

  • Two.ETwo.E Member Posts: 599
    edited May 2019

    It looks like @AlkaPP demo is everything you need.
    Did that solve your problem?

  • Two.ETwo.E Member Posts: 599
    edited May 2019
  • famekraftsfamekrafts Member, BASIC Posts: 834

    @Two.E said:
    It looks like @AlkaPP demo is everything you need.
    Did that solve your problem?

    Nope haven't checked it yet. But I am anyways using the current background as a map and shifting to a RPG game. Even if I solve the problem now, I believe I will get stuck later.

    Better create a non-moving background game.

Sign In or Register to comment.