Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Rungo73

I have an entity in WM called ladder that Im using multiple times in my level as an invisible entity over a ladder tile. When touched by the Player sets a flag onLadder to true.

Seems each copy of ladder in WM has an ID, so if I use it 3 times the IDS are 0, 1, 2. How can I set them all to be the same ID? or if not, how can I iterate through?

Heres the bit of code Im using thus far that works for a single instance of the ladder entity..

var  _ladder= ig.game.getEntitiesByType(EntityLadder)[0];
if(this.touches(_ladder))

if( this.onGround && ig.input.state("up") || !this.onGround  && this.vel.x < 75 && this.vel.x >-75){

this.onLadder = true;
  
} else{ this.onLadder = false;}}

1 decade ago by Joncom

var ladders = ig.game.getEntitiesByType(EntityLadder);
for(var i=0; i<ladders.length; i++) {
    var ladder = ladders[i];
    // Do something with each "ladder" now...
}
Page 1 of 1
« first « previous next › last »