Skip to content

Instantly share code, notes, and snippets.

/* generator
*
* takes a chance value, C, an array of objects, and returns a Generator
* function that computes a random value, R. if R < C the Generator returns
* nothing, else the Generator returns a random item from the array of
* objects.
*
* params:
* chance: floating point value between [0,1].
* objs: array of objects to select from.
ig.module (
'game.entities.Player'
)
.requires(
'impact.entity',
'impact.game',
'impact.font'
)
.defines(function(){
FeatureButton = ig.Entity.extend({
size: {
x: 100,
y: 50
},
r: 0,
b: 0,
init: function(x, y, settings) {
ig.module(
'game.entities.character'
)
.requires(
'game.entities.clickable',
'game.entities.difference',
'plugins.entityExtensions'
)