actor direction changed when using spawner.
ronre
Member Posts: 38
hello,
I have 3 actors that each one have his own target.
Now, i am using a spawner that spawn random actor by table.
before that, the actor moves to his target but with the spawner both of then move only to one target.
in the actors i have:
constrain attribute: self.angletotarget to: vectorToAngle( game.targetX - self.Position.X , game.targetY - self.Position.Y )
and "move" inside a "timer".
in the actor2 i have another angletotargetwo....
thats work good until i added the spawner.
the spawner have:
Timer and inside- change attribute: self.random to: random(1,3)
and rule with spawn actor for each actor.
thanks for help
Comments
Can you tell us what the rule is for actor2 ?
in actor 1 i have:
constrain attribute: self.angletotarget to: vectorToAngle( game.targetX - self.Position.X , game.targetY - self.Position.Y )
and constrain attribute: self.rotation to: self.angleToTarget +(30*cos( self.Time *500))
and "move" inside a "timer"
the target actor is "target"
for actor 2 i have:
constrain attribute: self.angletotargetwo to: vectorToAngle( game.targetX - self.Position.X , game.targetY - self.Position.Y )
and constrain attribute: self.rotation to: self.angleToTargetwo +(30*cos( self.Time *500))
and "move" inside a "timer"
the target actor is "targetwo"
and for actor 3 is the same with self.angletotargethird and in rotation self.angleToTargethird.
the target actor is "targethird"
You need to change the VectorToAngle behaviours to reflect the individual target values, at the moment all three VectorToAngle behaviours are returning the value of the angle between each actor and target 1.
At the moment . . .
vectorToAngle( game.targetX - self.Position.X , game.targetY - self.Position.Y )
vectorToAngle( game.targetX - self.Position.X , game.targetY - self.Position.Y )
vectorToAngle( game.targetX - self.Position.X , game.targetY - self.Position.Y )
What you should have . . .
vectorToAngle( game.targetX - self.Position.X , game.targetY - self.Position.Y )
vectorToAngle( game.target2X - self.Position.X , game.target2Y - self.Position.Y )
vectorToAngle( game.target3X - self.Position.X , game.target3Y - self.Position.Y )
ok so i need to add new attributes and then in the "target" actors i need to change the following?
now,
constrain attribute: game.targetX to: self.position.x
constrain attribute: game.targetY to: self.position.y
after change,
constrain attribute: game.targetwoX to: self.position.x
constrain attribute: game.targetwoY to: self.position.y
thats what i need to do for each target actor?
Yes.
Works great! I appreciate your help. Thank you