PDA

View Full Version : Scrolling Edges (like a side scroller or RTS game)


archonix
04-08-2003, 12:03 AM
Hi everyone,

I dont have a concept of how to "loop" the background so that when you hit the end of the image it will start displaying the other side. My image is tilable (tileable? sp) so that there isnt an obvious break in the image.

Alternately, albeit less cool, would be to just have the image STOP when you hit the bottom of it. Below is a sample of the code i'm using (feel free to use for your own applications)
onClipEvent(enterFrame){
up = 7;
if(_root._ymouse > 0 && _root._ymouse < 20){
_root.bgimg._y += up;

}
if(_root._ymouse > 180 && _root._ymouse < 200){
_root.bgimg._y -= up;


}
if (_root.bgimg._y > 100){
up = 0;
}


}


Let me breifly explain the "up" variable. Basically, I was trying to get the up/down motion to STOP when it hit a certain point ( when it was greater than 100) so I thought if I set their rates = up then set up to 0 if that happend it would work. At the moment its not.

In the end I'm going for what is on this page
http://www.macromedia.com/devnet/mx/flash/sample_files/html/scrolling_starfield.html
(yes I tried using the sample)
But I havn't had any luck integrating my mousemovement code inplace of the little buttons you slide up and down or left and right.

Thanks
-Alex-