Sha256: bd1c3b8c006c1ca845fe57bcc726e22018ed1bb6612dc78151c6bb7a9fad9374

Contents?: true

Size: 481 Bytes

Versions: 9

Compression:

Stored size: 481 Bytes

Contents

/**
 * class Character < Jax.Model
 * 
 */
var Character = (function() {
  return Jax.Model.create({
    after_initialize: function() {
      this.setPosition(0, 0, 0);
    },

    /* other Character-specific logic */
    attack: function(target) {
      target.takeDamage(this.damage);
    },

    takeDamage: function(amount) {
      this.hit_points -= amount;
      if (this.hit_points <= 0) {
        throw new Error("Character "+this.name+" died!");
      }
    }
  });
})();

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
jax-0.0.0.9 spec/example_app/app/models/character.js
jax-0.0.0.8 spec/example_app/app/models/character.js
jax-0.0.0.7 spec/example_app/app/models/character.js
jax-0.0.0.6 spec/example_app/app/models/character.js
jax-0.0.0.5 spec/example_app/app/models/character.js
jax-0.0.0.4 spec/example_app/app/models/character.js
jax-0.0.0.3 spec/example_app/app/models/character.js
jax-0.0.0.2 spec/example_app/app/models/character.js
jax-0.0.0.1 spec/example_app/app/models/character.js