Game Development Community

object reading others behavior?

by rennie moffat · in iTorque 2D · 10/25/2011 (1:13 pm) · 22 replies

I have run into something completely unexpected. I have a behavior, it is attached to objectX and objectY. The behavior tells objectOwner to move to pts A B C D. I do it on a count, moving at xSpeed. So...

function moverShaker_behavior::onPositionTarget(%this)
{
	%count = %count + 1;
	
	echo("frmtnSldr_bhvr::onBvAdd::onPosTarg");
	echo("frmtnSldr_bhvr::onBvAdd:: %this.name  " @ %this.name);
	echo("frmtnSldr_bhvr::onBvAdd:: %count  " @ %count);
	
	if(%count == 1)
	{
		//means owner has reached pos1
		%this.owner.moveTo(%this.pos2, %this.speed, true, true, true, 0.1);
		echo("frmtnSldr_bhvr::onBvAdd:: %this.name " @ %this.name);
	}
	if(%count == 2)
	{
		//means owner has reached pos1
		%this.owner.moveTo(%this.pos3, %this.speed, true, true, true, 0.1);
		echo("frmtnSldr_bhvr::onBvAdd:: %this.name " @ %this.name);
	}
}

What seems to be happening is that the objects are using each others pts for some reason as their counts are equal, the function is the same. Is it possible for the object to be reading the others instructions????

This is freaking me out.





About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.

Page«First 1 2 Next»
#21
10/30/2011 (12:23 pm)
No probs, yes, if you put a return in or use if ... else statements then it would be the same as the switch/case.
#22
10/30/2011 (12:32 pm)
sweet.
thanks again.


there is tho something about the visual read-ability of the case which makes it look more appealing.
Page«First 1 2 Next»