So I have a simple game going now with a character running forward and I have to jump and duck under barriers. I was able to make it all work so that one of my three random barriers I made comes at a random time at you. However, I don't know how to make it so that multiple barriers come at you. I feel I need some sort of loop. How should I alter the code I have already? This is on one of the barrier moveclips, the first part sets the platform and position to come at you and the second part moves that part towards you. P.s. this is in cs4.
Code:
onClipEvent (load) {
plat = Math.floor(Math.random()*3+1);
pos = 500+Math.random()*1000;
if (plat < 2 ) {
_root.platform._x = pos;
thing = 1;
} else if (plat < 3 && plat > 2) {
_root.platform2._x = pos;
thing = 2;
} else{
_root.platform3._x = pos;
thing = 3;
}
}
onClipEvent (enterFrame) {
if (thing == 1) {
_root.platform._x -= 7;
}
if (thing == 2) {
_root.platform2._x -= 7;
}
if (thing == 3) {
_root.platform3._x -= 7;
}
}