# Constrain one actor to another actors random spawn value - Logic Check

Member Posts: 58

I am spawning a goal sensor (score manipulator zone) and Am needing a quick check on my logic.

I create:

Global Boolean: goalPosY

Constrain the game.goalPosY to DualObj.PositionY

Spawn new actor to X:1050 and Y: gamePosY

I am sure I am missing some small detail (switched containers) but I have music to play and beer to drink on this glorious saturday!

If someone could look this over, don't out right give me the answer out right, give me a clue so I can figure it out.

thanks,
Dave

• Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,926

What is gamePosY? Did you mean to write game.goalPosY? Also, any time you're using position values you're going to want a Real attribute rather than something else (definitely not a Boolean since those only hold true/false or 1/0 values).

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

• Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,926

You might want to do this without a constrain behavior. Not sure exactly how your game is set up since you didn't provide a lot of details but you can probably just have the goal (or whatever DualObj is) spawn the sensor at X:1050 and Y: self.Position.Y [both relative to scene].

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

• Member Posts: 58
edited May 2018

Gotcha that makes sense, that’s what I was trying to do. I will post back with my progress tomorrow with this issue

• Member Posts: 58

I love overthinking stuff! said no one ever... .

In the end all I needed to do was make the goal sensor actor W: 20px H:768 and spawn it with the DualObj actor , mirror the movement and spawn actor logic between the two.

• Member Posts: 58

just finished this bit up. got the sensor spawned to the right actor, in the correct position at the correct frequency.

Also got the score bit working properly.