Actor not moving after a move to instruction
wln7844
Member Posts: 6
I'm trying to create random AI movements in a maze type environment.
My problem now is I have a "Move To" instruction when the Actor overlaps with a panel placed in the maze. The Actor then moves to an X,Y position I set. When it gets here I want it to move again when the Attributes "Self Postion" X,Y are equal to where I sent it to In the previous "Move To" instruction. But now my Actor moves to the position then stops and doesn't do the next instruction. Any ideas what I'm doing wrong here would be greatly appreciated.
My problem now is I have a "Move To" instruction when the Actor overlaps with a panel placed in the maze. The Actor then moves to an X,Y position I set. When it gets here I want it to move again when the Attributes "Self Postion" X,Y are equal to where I sent it to In the previous "Move To" instruction. But now my Actor moves to the position then stops and doesn't do the next instruction. Any ideas what I'm doing wrong here would be greatly appreciated.
Comments
I would suggest instead of having it once it reaches the point, have it try to reach the point plus or minus one pixel.
However, someone else might have a better solution than me.
Thanks for the input. It is much appreciated
I've merged your two threads.
Also, if you can post a sketch (see my signature for instructions) of what you're trying to achieve, I'm sure someone here can come up with a solution. Are you trying to snap to a grid or something else?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Using the X > 39 and X < 41 worked after I put in a timer to keep checking my X Y position every 0.001 seconds. Will repeating this over for each intersection cause my game to run very slow?
This is usually done as follows:
Change Attribute self.position.X to (floor(self.position.X/game.gridSize))*game.gridSize
You may need to use ceil in place of floor or to actually use a mod function (more on that later if you need it...) to determine whether to use ceil or floor in that formula.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I would like to invert my X,Y velocity of my Ai if it overlaps or touches another Ai.
What formula would best suit this. Say my Ai was travelling at X=100 Y=0 and touched another Ai I'd like that value to change to X=-100 Y=0
Change Attribute
self.motion.linear.X = -(self.motion.linear.X)
And the same for the Y velocity?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User