scrolling background with gaps
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
scrolling background with gaps
I want to delete this post
Last edited by star0629 on Sat Jan 11, 2014 4:11 pm, edited 1 time in total.
Re: scrolling background with gaps
Hi star0629,
hmm, maybe a "lock screen" might help?
And do not use THE when addressing objects:
BAD: left of THE image...
GOOD; left of image...
Try this:
Best
Klaus
hmm, maybe a "lock screen" might help?
And do not use THE when addressing objects:
BAD: left of THE image...
GOOD; left of image...
Try this:
Code: Select all
on moveBg
lock screen
## use a repeat loop to save some typing :-)
repeat with i = 1 to 3
set the left of img ("bg" & i) to the left of img ("bg" & i) - 4
if the right of img ("bg" & i) < 0 then
set the left of img ("bg" & i) to 818
end if
end repeat
## DONE, lift curtain :-)
unlock screen
updateScore
end moveBg
Klaus
Re: scrolling background with gaps
nope that didn't work and the images continue to overlap each other :@ ...once they go the card they start again to the beginning position overlapped :/
Re: scrolling background with gaps
Hi,
Where do the images start? Are their locs initialized?
I see no problems with your script, in that the three images move in lock-step as you ordered, reappearing at the right when they disappear off screen to the left. What "overlap" are you seeing? The images are, as I said, in lock-step.
Craig Newman
Where do the images start? Are their locs initialized?
I see no problems with your script, in that the three images move in lock-step as you ordered, reappearing at the right when they disappear off screen to the left. What "overlap" are you seeing? The images are, as I said, in lock-step.
Craig Newman
Re: scrolling background with gaps
The images are positioned at the front in the middle of the card e.g
"Image1" "Image2"
I dont code anything for the images to be in that certain location, i just happen to put them there and then lock the position when on edit mode. What i mean by over lap is when the game is running the images are scrolling along the card, once "image1" goes off the card (left side) it reappears from the right side of the card (here is when is begins to overlap) whilst "image1" is scrolling along as expected, "image2" has gone of the card (left side) and where there is supose to be a gap between the two images is filled up and the "image2" appears closer to "image1" as if "image2" is moving at a faster rate than "image1" this continues until "image2" has gone in front of "image1" somehow.
Could it possibly be becuase of the size of the image i am using? Do they all have to be same in length and height and stuff?
Thanks
"Image1" "Image2"
I dont code anything for the images to be in that certain location, i just happen to put them there and then lock the position when on edit mode. What i mean by over lap is when the game is running the images are scrolling along the card, once "image1" goes off the card (left side) it reappears from the right side of the card (here is when is begins to overlap) whilst "image1" is scrolling along as expected, "image2" has gone of the card (left side) and where there is supose to be a gap between the two images is filled up and the "image2" appears closer to "image1" as if "image2" is moving at a faster rate than "image1" this continues until "image2" has gone in front of "image1" somehow.
Could it possibly be becuase of the size of the image i am using? Do they all have to be same in length and height and stuff?
Thanks
Re: scrolling background with gaps
Have you locked the size of the images? This can cause problems, and has no bearing on their manipulation under script control.
Craig
Craig
Re: scrolling background with gaps
Yeah the lock size and position box is ticked on all the images
Re: scrolling background with gaps
Hi star0629,
From your block of code:
if the right of the image "bg1" < 0 then
set the left of the image "bg1" to "822" - 4
end if
Would it be more accurate to say
if the right of image "bg1" < 0 then
set the left of image "bg1" to the (right of image "bg3" - 4)
end if
That way it doesn't matter the size of your images and you don't have to rely on that 822.
Simon
Edit: dropped "the"
From your block of code:
if the right of the image "bg1" < 0 then
set the left of the image "bg1" to "822" - 4
end if
Would it be more accurate to say
if the right of image "bg1" < 0 then
set the left of image "bg1" to the (right of image "bg3" - 4)
end if
That way it doesn't matter the size of your images and you don't have to rely on that 822.
Simon
Edit: dropped "the"
Last edited by Simon on Tue Dec 10, 2013 5:56 am, edited 1 time in total.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: scrolling background with gaps
Simon,
Have not looked at your idea. But I stuck an arbitrary hard value in the test stack I made, and all was in lock-step.
Craig
Have not looked at your idea. But I stuck an arbitrary hard value in the test stack I made, and all was in lock-step.
Craig
Re: scrolling background with gaps
Im so lost and confused what to do..also the fact it must have gaps in between the images and that is the main problem..it wont display they gaps and overlaps each other instead :/
Re: scrolling background with gaps
That is why I suggested using the right and left of the images... can't overlap.it wont display they gaps and overlaps each other instead :/
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: scrolling background with gaps
Simon.
Craig
But he is saying that the one image continually advances over another at each pass. You have fixed the overlap, but there is something else going on that I do not see. I have lock-step. He has changing relative horizontal motion.once "image1" goes off the card (left side) it reappears from the right side of the card (here is when is begins to overlap) whilst "image1" is scrolling along as expected, "image2" has gone of the card (left side) and where there is supose to be a gap between the two images is filled up and the "image2" appears closer to "image1" as if "image2" is moving at a faster rate than "image1" this continues until "image2" has gone in front of "image1" somehow.
Craig
Re: scrolling background with gaps
Hi Craig,
Yes, sorry, the move rates are different, now I get it.
I messed up on what the "set the left of the image "bg1" to the left of the image "bg1" - 4" was for.
And for my sins I attach a stack that proves essentially star0629 code works (with fixes mentioned by Klaus and Craig).
So there is something else in the code setting positions of the images.
Unless I got it all wrong again
Simon
Yes, sorry, the move rates are different, now I get it.
I messed up on what the "set the left of the image "bg1" to the left of the image "bg1" - 4" was for.
And for my sins I attach a stack that proves essentially star0629 code works (with fixes mentioned by Klaus and Craig).
So there is something else in the code setting positions of the images.
Unless I got it all wrong again

Simon
- Attachments
-
- marchOn.zip
- LC 6.5
- (828 Bytes) Downloaded 269 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: scrolling background with gaps
Simon.
I think the mystery lies with Mr. Star.
Mr Star?
Craig
I think the mystery lies with Mr. Star.
Mr Star?
Craig
Re: scrolling background with gaps
Thanks everyone for your help somehow got it to work..not exactly as i hoped, but it works.