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 ethanklein

Hi. I have a level with multiple buttons and multiple doors.
I'm trying to code it such that when my player touches a button a door opens.
Each button controls a separate door.
I'm attempting to use 'target' and 'name' entity properties in weltmeister to link all the entities accordingly.
My problem is that the entity properties don't seem to be saving correctly in weltmeister.

I'm following the instructions found in 'manipulating entities' here:
http://impactjs.com/documentation/weltmeister

Also... i've able to successfully give names to my entities in the init() function of the button.js and door.js.

I can't figure out how to uniquely identify each instance of an entity in a level. Currently i'm using javascript's random number generator as a placeholder:

init: function( x, y, settings ) {
      this.parent( x, y, settings );
      this.addAnim('on', .07, [0]);
      this.addAnim('off', .07, [1]);
      this.name = "switchOn" + Math.floor(Math.random() * (20 - 1 + 1) + 1);
    },

Am I missing something about saving entity properties in weltmeister. It looks easy but i get 'undefined' whenever attempting to print the name of an entity I've named in weltmeister.

Thanks!!!

1 decade ago by abern421

I'm also new to ImpactJS, but I was able to make the entity naming and trigger work just as documented.

Do you press enter after you enter the value?

It's all I can think of.
Page 1 of 1
« first « previous next › last »