making a seamless scrolling background

digitalzerodigitalzero Member, BASIC Posts: 639
i thought i knew how to do this with the whole scene wrap thing but im getting gaps... i remember reading about this WAY earlier when i first started gamesalad but either im tripping or something just plain aint working theres a big gap -_-... my image is 1083... can i get some help from you lovely people???

Comments

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Your image should always be even numbers when divided by 2 otherwise your images may blur ... Explain how exactly you have your rules setup, just saying there is a big gap does not help us help you.
  • SocksSocks London, UK.Member Posts: 12,822
    Like @beefy_clyro says if you want people to help solve an issue with your project you're going to have to give them a little more to work with than a single 4 digit number.
  • digitalzerodigitalzero Member, BASIC Posts: 639
    @beefy_clyro and @socks the only rule that i have set up for my background actor is a change attribute self.motion.linearvelocityx to -300 and of course for the scene attribute i checked wrap x which is all that i thought that i needed to do
  • FajlajpFajlajp Member Posts: 666
    edited March 2013
    I made a quick demo for you(not the best graphics)
    https://www.dropbox.com/sh/lr6r2o8edf7am8c/cY0seHWKn3
    It´s that what you looking for?
  • digitalzerodigitalzero Member, BASIC Posts: 639
    @fajlajp thats the idea that im looking for but i am not looking for parralax at all i just have one image scrolling throughout the background which is the background image
  • digitalzerodigitalzero Member, BASIC Posts: 639
    there are no move left or move right buttons the background moves by itself so it seems like youre running
  • ericzingelerericzingeler Member Posts: 334
    what are the sizes of the scene and background?
  • digitalzerodigitalzero Member, BASIC Posts: 639
    @ericzingeler the size of the scene is 1083x1083 (the reason its so high is because i have actors that would be getting called upon) and the size of the actor is 1083x320
  • digitalzerodigitalzero Member, BASIC Posts: 639
    and on the scene wrap x is checked already
  • AfterBurnettAfterBurnett Member Posts: 3,474
    If your image is 1083 it's going to be treated as a 2048 image. You should try to keep it below 1024, as it is closer to that size. Images need to be power of 2, so, 16, 32, 64, 128, 256, 512, 1024 etc. GS will handle non power of 2 images but at a huge loss to performance. As for the scrolling, I had this issue with my first GS game and solved it. Will dig up how I did it and post :)
  • AfterBurnettAfterBurnett Member Posts: 3,474
    image

    Hope that helps. You'll need to adjust the values for your image size, obviously.
  • digitalzerodigitalzero Member, BASIC Posts: 639
    @polygame what exactly are those numbers (720 and the 240)
  • digitalzerodigitalzero Member, BASIC Posts: 639
    and the negative 240
  • digitalzerodigitalzero Member, BASIC Posts: 639
    wait nevermind i think i got it... but that formula did not work for mines for some reason
  • AfterBurnettAfterBurnett Member Posts: 3,474
    The 240 is half of the width of the screen (@480). So when it reaches the -240 it is reset. Can't remember what the 720 is... maybe I was naughty and using images that weren't power of 2? lol. SHould work if you adjust for your sizes/resolution.

    I did have some code I was using in the Unity version which is similar but I changed to scrolling textures, not two objects... I'll see if I can find the original formula, that should help...
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Okay, here's my code in US:

    transform.localPosition.x += (fRightPosition * 2)-(fLeftPosition * 2);

    So basically, when the screen hits the left position set it to the current position + ((right position * 2) - (left position * 2))

    Obviously the left and right positions will depend on the size of the display/graphic file dimensions etc.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    edited March 2013
    I'll try be clearer (I should NEVER be a teacher, I'm confusing myself!):

    when self.position.x == left position,
    self.position.x = self.position.x + ((right position * 2) - (left position * 2))

    Hope this helps :)

    EDIT: I haven't tried this in GS... hope it works...
  • FajlajpFajlajp Member Posts: 666
    edited March 2013
    Here is a little demo I made with what you searching for. It´s simple. The picture only loops so I hope you learn something with this.
    https://www.dropbox.com/sh/lr6r2o8edf7am8c/cY0seHWKn3?m
    (Only change the game.scrollspeed attribute to control the speed of the scrolling)

    Edit: You maybe have to change a little bit in the rule to make your picture that is 1083 width. (Say if you need help with that to)
Sign In or Register to comment.