Ok, this is what i did. I created an invisible spawner to check for certain conditions, then perform as needed. Komodo throws no errors, and impact runs the game error free in my server, BUT, lol it refuses to summon the dang entity. these 5 entities will rest at the top of the board and drop skulls(gems) into columns as spaces become empty. they will also work in conjunction with the other 30 "killers" to kill skull combos as they happen. Here the code.....
ig.module (
'game.entities.b1'
)
.requires (
'impact.entity'
)
.defines (function() {
EntityB1 = ig.Entity.extend ( {
size: { x:20, y:20},
//this.pos.x = // to be set later after testing
//this.pos.y =
collides: ig.Entity.COLLIDES.FIXED,
type: ig.Entity.TYPE.B,
checkAgainst: ig.Entity.TYPE.A,
_wmDrawBox: 'true',
_wmBoxColor: 'rgba( 255, 0, 0, 0.5 )',
init: function() {
// mouse/touch code to go here.
},
update: function() {
var skull = [];
var attack = 'false';
var spawn = '1';
this.parent();
},
check: function ( other ) {
if(other.standing == 'true') {
if(this.touches(other instanceof EntityPuck)) {
this.skull = [R]
} else
if(this.touches(other instanceof EntityGreenskull)){
this.skull = [G]
} else
if(this.touches(other instanceof EntityBlueskull)) {
this.skull = [B]
} else
if(this.touches(other instanceof EntityYellowskull)) {
this.skull = [Y]
} else
if(this.touches(other instanceof EntityOrangeskull)) {
this.skull = [O]
} else
if(this.touches(other instanceof EntityPurpleskull)) {
this.skull = [P]
} else
if(this.touches(other instanceof EntityWhiteskull)) {
this.skull = [W]
}
};
if(this.attack == 'true') {
kill( other ) // add score code here....
}
// B6 - B35 end here.
// spawning code, B1 - B5 ONLY
this.spawn = rand( 1, 7 ); // commented out to test case '1'
switch (spawn) {
case '1':
ig.game.spawnEntity( EntityPuck, 32, 0 ); // 'puck == Redskull for testing
this.spawn = 0;
break;
case '2':
ig.game.spawnEntity(EntityBlueskull, this);
this.spawn = 0;
break;
case '3':
ig.game.spawnEntity(EntityGreenkull, this);
this.spawn = 0;
break;
case '4':
ig.game.spawnEntity(EntityYellowkull, this);
this.spawn = 0;
break;
case '5':
ig.game.spawnEntity(EntityPurpleskull, this);
this.spawn = 0;
break;
case '6':
ig.game.spawnEntity(EntityOrangeskull, this);
this.spawn = 0;
break;
case '7':
ig.game.spawnEntity(EntityWhiteskull, this);
this.spawn = 0;
break;
};
},
});
});
i'm using the puck.js file slightly modded to use as a place holder for my graphic(still in process) code:
EntityPuck = ig.Entity.extend({
size: {x:48, y:48},
collides: ig.Entity.COLLIDES.FIXED,
type: ig.Entity.TYPE.A,
checkAgainst: ig.Entity.TYPE.A,
animSheet: new ig.AnimationSheet( 'media/puck.png', 48, 48 ),
init: function( x, y, settings ) {
this.parent( x, y, settings );
this.addAnim( 'idle', 0.1, [0,1,2,3,4,4,4,4,3,2,1] );
this.vel.x = 0
this.vel.y = 30
},
});
});
vel.x is set to 0 so that it will fall straight down via gravity. otherwise it tries to move across the x axis.
like i said, i'm just not sure what i'm doing wrong. i get no exceptions thrown at me, it just won't give me the dang puck. lol.
thanks for your input thusfar, and i'm sure you're about to knock this one out the box.