Comparison

How can I make it so that the enemy only moves if the player is within 100 of the enemy? Like if player.x - enemy.x <= 100?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2013
    Just create a game attribute of type integer and set it to 100, and then reverse the equation:

    When game.oneHundred >= player.x-enemy.x ... [behaviors]

    Or, solve your equation for either of the attributes:

    When player.x < = 100 + enemy.x ... [behaviors]

    Or, constrain game.enemyDistance to player.x-enemy.x and then use that attribute in a rule.

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

Sign In or Register to comment.