SultanMomi's Forum Posts

  • 5 posts
  • Perfect, thank you :)

  • I have following event:

    I would like to know how you can access the instances which are triggered by the collision event.

    With adding action you can easy acces them as it seen on the picture.

    But is that with javascript possible too?

    Tagged:

  • Oh okay. I understand. Thank you so much. I had the wrong understanding.

  • Thanks, good to know.

    But why is not an error message appearing?

    And i changed the code so that the "tick" event is defined for the object class:

    runtime.objects.Axt.addEventListener("tick", runtime.globalVars.class_Axt.mapObject_moveto)

    But still it isnt working. The event does not trigger. I put an alert in the static function runtime.globalVars.class_Axt.mapObject_moveto. Is there a better way to test or debug whether events trigger?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi,

    i have the following code in which I define a class:

    runtime.globalVars.class_Axt = class axt {

    constructor() {

    this.name = "Axe"

    this.MapObject = 0

    this.ziel_person = 0

    }

    ausruesten(ziel_person) {

    this.ziel_person = ziel_person;

    this.ziel_person.onHand = this;

    this.MapObject = runtime.objects.Axt.createInstance("Items", this.ziel_person.MapObject.x, this.ziel_person.MapObject.y, false);

    this.MapObject.addEventListener("tick", this.mapObject_moveto);

    }

    mapObject_moveto() {

    this.MapObject.x = this.ziel_person.MapObject.x;

    this.MapObject.y = this.ziel_person.MapObject.y;

    }

    }

    Then I create objects and use the method ausruesten:

    runtime.globalVars.a = new runtime.globalVars.class_Axt();

    runtime.globalVars.max = new runtime.globalVars.class_Person(runtime.objects.MainPlayer.getFirstInstance());

    runtime.globalVars.a.ausruesten(runtime.globalVars.max);

    Everything works as intended except the addEventListener in ausruesten method. Im not sure whats wrong. I tested it a lot but the event is never triggering. Can someone help me and explain how it could work and why?

    Tagged:

  • 5 posts