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 rampy

So thanks to some kind forum members, I've got a simple power meter for my golf game working.

What I want to do is upon ig.input.released send some parameters to my golfball entity to move it :)

can i do something like ig.entity.golfball(vel.x, vel.y);

or update it directly with ig.entity.golfball.vel.x = newvalue;

or should i call the golfball object from within powerbar and ????

know what i mean?

Sorry if this is a noob question ....

rampy

1 decade ago by stahlmanDesign

try something like :
for (var i=0;i<ig.game.entities.length;i++){
 if (ig.game.entities[i] instanceof EntityGolfball){
  ig.game.entities[i].vel.x = newX;
  ig.game.entities[i].vel.y = newY;
 }
}

1 decade ago by rampy

Thanks, I'll give it a shot... is there no way to call it by name/reference instead of index # e.g.

ig.game.entities['Golfball'].vel.x= newX;

Just curious.

1 decade ago by RomainT

If your entity has a name attributes you can use ig.game.getEntityByName. :)
Page 1 of 1
« first « previous next › last »