One works, one doesn't - what's the difference between them?
Backtothis
Member, PRO Posts: 75
So I have two different ways for dynamically adjusting an actor's position relative to another actor. One works, the other doesn't.
Method 1:
When Any of (self.Position.X != game.OffsetX + game.OtherActorX) OR (self.Position.Y != game.OffsetY + game.OtherActorY)
--> Change Attribute self.Position.X := game.OffsetX + game.OtherActorX
--> Change Attribute self.Position.Y := game.OffsetY + game.OtherActorY
Method 2:
Timer every 0.1 seconds
--> Change Attribute self.Position.X := game.OffsetX + game.OtherActorX
--> Change Attribute self.Position.Y := game.OffsetY + game.OtherActorY
game.OffsetX and game.OffsetY change depending on the state of the other actor. I have confirmed that they are changing when and as they should by a debug actor that displays all these values onto the screen. game.OtherActorX and game.OtherActorY remain static the entire time as intended. One method works and the other only works after the scene is reached for the second time, and after 2 to 5 changes in the other actor's state. What's the difference between them?
Method 1:
When Any of (self.Position.X != game.OffsetX + game.OtherActorX) OR (self.Position.Y != game.OffsetY + game.OtherActorY)
--> Change Attribute self.Position.X := game.OffsetX + game.OtherActorX
--> Change Attribute self.Position.Y := game.OffsetY + game.OtherActorY
Method 2:
Timer every 0.1 seconds
--> Change Attribute self.Position.X := game.OffsetX + game.OtherActorX
--> Change Attribute self.Position.Y := game.OffsetY + game.OtherActorY
game.OffsetX and game.OffsetY change depending on the state of the other actor. I have confirmed that they are changing when and as they should by a debug actor that displays all these values onto the screen. game.OtherActorX and game.OtherActorY remain static the entire time as intended. One method works and the other only works after the scene is reached for the second time, and after 2 to 5 changes in the other actor's state. What's the difference between them?
Comments
Hi, it's probably because the use of a timer in the second situation isn't really a working solution... I think your second method should use Constrain behaviours... you should find it'll be a constantly updated process then.
Method 2:
--> Constrain Attribute self.Position.X := game.OffsetX + game.OtherActorX
--> Constrain Attribute self.Position.Y := game.OffsetY + game.OtherActorY
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User