Actor moving towards another

peterraadpeterraad Member Posts: 56
edited January 2014 in Working with GS (Mac)
Hello I have a game where your the spaceship and you have to dodge and shoot enemies as they come flying into the screen. I have an issue though with the enemy movement. I made 2 attributes globally (when your in the scene) with Player-X, and Player-Y. My spaceships name is Player and i constrained the two attributes with the position of my player actor (self.position.x/y) and then i put the move to function into the enemy and set the positions to: game.Player-X and game.Player-Y the two attributes are REAL. But all the enemy does is move to 0,0 and nowhere else. Please help and be specific with your solutions. I also looked at numerous posts about this and did exactly what it told me to do but in the end it still did the same thing.
THANKS

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Move and Move To behaviors only run once with whatever values the attributes have when the scene starts or the rule condition becomes true. In other words, even though you are constraining the spaceship's position to game attributes, your Move To behavior is using the initial/default values of those attributes, which are 0 for both. What you need to do is to put the Move To behavior inside of an every 0 seconds timer so that it repeatedly runs with the current values of those attributes.

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

Sign In or Register to comment.