[SOLVED] Bugs With Advanced Intelligence

the ai is more complete but now this cod does not work - Chase.prototype.setAnimation = function (state) {
if (this.state !== state)
var states = Chase.states;

    this.state = state;
    // Set the current animation, taking 0.2 seconds to blend from
    // the current animation state to the start of the target animation.
    this.entity.findByName("model").animation.play(states[state].animation, 0.2);

};

You missed the brackets.

Chase.prototype.setAnimation = function (state) {
    if (this.state !== state) {
        var states = Chase.states;

        this.state = state;
        // Set the current animation, taking 0.2 seconds to blend from
        // the current animation state to the start of the target animation.
        this.entity.animation.play(states[state].animation, 0.2);
    } 
};