Event listeners in plugin?

  • Can event listeners like onmousedown be used in plugins?

  • Of course. That's how all the input plugins work. You just have to be careful that if you capture an event and stop its propagation, other plugins won't see it.

  • Awesome. Thanks for the response. Iv'e been looking at some of the plugins and the templates trying to figure out how everything fits together. I'm trying to have a plugin that distorts an image based on mouse input.I see plugins that draw images are of the world type and plugins that capture user input are of the type object. Is it possible to have one plugin that does both. Or do I need to have my plugin communicate with the mouse plugin? If so then whats the best way to set up the event sheet. I was thinking some thing like mouse-left button is down, then have that call a function.

    function mouseDown(e){

         mouseIsDown=true;

         mouseDownPosLastX=e.clientX;

         mouseDownPosLastY=e.clientY;     

    }

    So my plugin can see the x and y position. Is this type of interaction possible? Sorry for hitting you with so many questions at once.

  • After much trial and error I have determined it is possible for one plugin to both draw images and interprets user input. Now the only question is are there any draw backs to setting up a plugin this way?

  • You can set up plugins however you like. It's just javascript code.

  • Try Construct 3

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

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

    Do you have any sucess with that plugin of yours?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)