I have a gigantic movieclip which is something like 12000 pixels by 2800. As user you scoll through this movieclip. The x scrolling is always 20 pixels but the y scrolling changes a lot, you follow a line who moves randomly up and down (it’s a mountain). In the movieclip I have put a lot of walls and when you pass them, the ySpeed changes. it goes something like this:
public function movemeright(evt:Event) {
if (topleft==true) {
if (camerastage.hitTestObject(mountain.cameramove_1)) {
bergsnelheidY=10;
trace("1");
}
if (camerastage.hitTestObject(mountain.cameramove_2)) {
bergsnelheidY=-4;
trace("2");
}
if (camerastage.hitTestObject(mountain.cameramove_3_1)) {
bergsnelheidY=0;
trace("3.1");
}
if (camerastage.hitTestObject(mountain.cameramove_3)) {
bergsnelheidY=20;
trace("3");
}
rightMoveTween()
}
public function rightMoveTween():void {
TweenLite.to(mountain,mountaintime, {x:mountain.x-standaardsnelheid, y:mountain.y+bergsnelheidY});
}
This is only a snippet and it seems in my eyes really time-consuming, it could be a lot more compacter I think. Is there a way where I can say: the Line.mc has always to be 100 pixels above stage.width?