I am making a level for a recent project, and basically Object7/8
animate left and right using these two functions I have animateRight()
animateLeft()
I want to have FfirstObj
To animate up and down 70px each way, but I want to use this same method as the left and right animation. I have tried 3 times in tota and failed, I really want to keep this method because it works very well for me. I think the problem is im calling 4 different functions at once?
Any suggestions, below is some code and a link, thanks!
var fourLevelMove = ["#FseventhObj", "#FnineObj"];
var fourLevelMoveone = fourLevelMove.join(",");
$(fourLevelMoveone).css('margin-left', '0px');
animateRight();
function animateRight() {
$(fourLevelMoveone).stop().animate({
'marginLeft': "+=220px" //moves left
}, 1100, animateLeft);
}
function animateLeft() {
$(fourLevelMoveone).stop().animate({
'marginLeft': "-=220px" //moves right
}, 1100, animateRight);
}
And HERE is the link.