[fmx/fmx2004]Problems with game

Hey guys. I’m working on a Mario-type game and I’ve come across a problem :puzzled: Take a look at this code. When the man jumps on the blob, the hitTest won’t register. This only happens when the code checks the hitTest and if the man is airborn. If “&& airborn” is eliminated, the blob will be removed when the man makes contact with it anytime, even if the man is not jumping. Help me out, will ya?

-MC with instance name “man”-

onClipEvent (load) {
	xs = 0;
	ys = 0;
	force = 1;
	ms = 10;
	friction = 0.8;
	jforce = 18;
	airborn = true;
	fl = _root.fl;
}
onClipEvent (enterFrame) {
	this._x += xs;
	xs *= friction;
	if (Key.isDown(Key.RIGHT)) {
		this.gotoAndStop(2);
		this._xscale = -100;
		xs += (force<ms);
	} else if (Key.isDown(Key.LEFT)) {
		this.gotoAndStop(2);
		this._xscale = 100;
		xs -= (force<ms);
	} else {
		this.gotoAndStop(1);
	}
	this._y += (ys += _root.grav);
	if (this._y>fl) {
		this._y = fl;
	}
	if (this._y == fl) {
		ys = 0;
		airborn = false;
	} else {
		airborn = true;
	}
	if (Key.isDown(Key.UP) && !airborn) {
		ys = -jforce;
	}
	if (airborn) {
		this.gotoAndStop(3);
	}
}

-MC with instance name “blob”-

onClipEvent (load) {
	xscale = random(1);
	if (xscale == 1) {
		this._xscale = 100;
	} else {
		this._xscale = -100;
	}
	xs = random(3)+1;
	ys = 0;
	d = 0;
}
onClipEvent (enterFrame) {
	if (this._name != "blobinstance") {
		if (this._xscale == 100) {
			this._x += xs;
		}
		if (this._xscale == -100) {
			this._x -= xs;
		}
		if (this._x>_root.rbounds) {
			this._xscale = -100;
		}
		if (this._x<_root.lbounds) {
			this._xscale = 100;
		}
		this._y += (ys += _root.grav);
		if (this._y>_root.fl) {
			this._y = _root.fl;
		}
		if (this._y == _root.fl) {
			ys = 0;
		}
		if (this.hitTest(_root.man._x, _root.man._y, false) && _root.man.airborn) {
			this.removeMovieClip();
		}
	}
}

-Frame 1-

lbounds = 0;
rbounds = 550;
fl = 350;
grav = 3;
d = 0;
for (i=0; i<5; i++) {
	blobinstance.duplicateMovieClip("blob"+d+1, d++, {_x:random(550)});
}

That is the first problem. Problem #2 is much easier. Here is the code:

d = 0;
score = 0;
scoretxt.autoSize = true;
// level = [pointsToWin, enemy spawnTime, [enemy array: b = blob - sb = spike blob - jb = jumping blob]]
lev1 = [30, 48, ["b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b"]];
spawnTimer = lev1[1];
onEnterFrame = function () {
	spawnTimer--;
	for (i = 0; i lt lev1[0]; i++) {
		if (spawnTimer lt= 0) {
			if (lev1[2]* == "b") {
				blobinstance.duplicateMovieClip("blob"+d+1, d++, {_x:dropper._x, _y:dropper._y});
				_root.dropper.endX = random(540);
			}
			spawnTimer = lev1[1];
		}
	}
};

The problem: The for statement is an infinite loop… it just keeps creating duplicating the blob every 2 seconds. It should only create 30 blobs. This is a real problem… someone please help :huh:

NOTE: i changed the less then sign to “lt” because it thought it was html