large scrolling background (6000px height)

Subscribe to large scrolling background (6000px height) 10 posts, 5 voices

Sign in to reply


 
avatar for Lofi Lofi 46 posts
Flag Post

my background has 6000px in height. afaik flash is limited to +/-2880px. what’s the preferred and performing way to deal with such large scrolling backgrounds in as3?

 
avatar for MoonlaughMaster MoonlaughMaster 3277 posts
Flag Post

Break it into tiles.

 
avatar for Lofi Lofi 46 posts
Flag Post

yeah, that’s the obvious solution. but how to proceed then? simple image copying? and if so, how? or the gotoandstop solution with frames?

 
avatar for MoonlaughMaster MoonlaughMaster 3277 posts
Flag Post

Are you saying that the flash movie is 6000px, or the background pic is?

 
avatar for Lofi Lofi 46 posts
Flag Post

the level is 6000px in height, ie the pic

 
avatar for MoonlaughMaster MoonlaughMaster 3277 posts
Flag Post

Break it into tiles, then line it up into one picture again in one big MovieClip.

 
avatar for asdronin asdronin 49 posts
Flag Post

but if one break this into tiles, will it be necesary to manually hide all the tiles that are not currently on screen? as I have seen offscreen material is also giving performance hit at times, and with big background there should be some tiles that are offscreen at the same time… or will it be the same if they are not hidden?

 
avatar for flipmytext flipmytext 500 posts
Flag Post

it breaks tiles?

 
avatar for asdronin asdronin 49 posts
Flag Post

well, yes, breaking the background into tiles theorically should do, but I dont seem to know how to perform this to avoid performance hit, hidding them when they are offstage wont make it more fluent…. any idea?

 
avatar for Cervello Cervello 76 posts
Flag Post

well, yes, breaking the background into tiles theorically should do, but I dont seem to know how to perform this to avoid performance hit, hidding them when they are offstage wont make it more fluent…. any idea?

Here’s an example: Say you have a background 6000px high and you want it to scroll upwards and loop. Your game is, say, 500px high. You break the background into 10 different 600px slices (size doesn’t matter so long as each slice is longer than the game, in this case >500px).

One way to do this is to make a movieclip that has 10 frames, with each 600px slice on the same position in each frame.

  1. Put two copies of this “slice” movieclip (with different instance names, like “slice_1” and “slice_2”) on the stage.
  2. Keep two integer variables to keep track of the “slice number” you want each slice to be on (starting at 1 for slice_1 and 2 for slice_2).
  3. Put slice_1 so it’s top lines up with the top of the stage, and slice_2 so it’s top lines up with slice_1’s bottom.
  4. When the game begins, use gotoAndStop to set each MC’s frame to display the slice you want. (So slice_1 goes to frame 1 and slice_2 goes to frame 2).
  5. Move both slices up at the same speed. When one slice goes completely offscreen (first one to do so will be slice_1), increase it’s “slice number” integer by 2, then use gotoAndStop to set the image displayed by the MC to that slice, then move it’s position 600px down so it’s directly under the other slice.
  6. So slice_1 should now be on frame 3, and it’s top should be lined up with slice_2’s bottom.
  7. Keep doing this as long as you like. Just make sure that when the slice that moves offscreen is on frame 9, it’s looped back to frame 1. Same goes for frame 10, loop it back to frame 2.



…got all that? >.>

Sign in to reply


Click Here