Skip to content

Instantly share code, notes, and snippets.

@distributedlife
Last active December 14, 2015 21:29
Show Gist options
  • Select an option

  • Save distributedlife/5151529 to your computer and use it in GitHub Desktop.

Select an option

Save distributedlife/5151529 to your computer and use it in GitHub Desktop.
define(['cricket/server_player', 'lib/event_emitter'], function(ServerPlayer, EventEmitter) {
"use strict";
return function(fielding_ai, bowling_ai, batting_ai) {
var _this = new ServerPlayer();
_this.init = function() {
_this.typename = "ai";
EventEmitter.call(_this);
fielding_ai.call(_this);
};
_this.init();
return _this;
};
});
define(['cricket/terms'], function(Terms) {
"use strict";
var fielding_ai = function(slice) {
function set_field(field) {
field.mad_logic();
this.emit_event('player/over/set_field/complete');
}
return function() {
this.set_field = set_field;
return this;
};
}([].slice);
return fielding_ai;
});
function some_codez(ai, field) {
ai.set_field(field);
}
//Uncaught TypeError: Cannot call method 'emit_event' of undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment