0 Favourites

On Collision With Object - Why Not Part Of Function?[UPDATE]

  • Sprite - On Collision With Another Object - Destroy, etc.

    Why can't this be part of a function?

    There's no way to drag it in, Construct 2 won't allow it, so I'm guessing it's programmed this way.

    Why?

    It would make programming some things a lot easier.

    What's so special about this that it has this exception?

    I was able to do a workaround for what I needed, actually learned some cool new things by doing things in reverse vs. what I knew in this weird sequence (since this has to be outside a function), but if this was possible it would enable more complex functions and save a few lines of code here and there.

    From reading somewhere, I remember the green arrow means it's executed only once?

    How do you change it to once per tick?

    And again, why was this programmed this way?

    You could argue it's already its own function since it executes once by default, but I just don't understand why it's singled out with this exception and complicates programming a bit.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • The green arrow means it's a trigger most of the time. "On collision" is actually equivalent to "is overlapping" and "trigger once". If you want to check for a collision in a function just use the "is overlapping" condition.

  • Ah, thank you.

    Had no idea.

    P.S. Love your portal code!

    On Collision With; however is executed once per the green arrow.

    Overlapping With is once per tick, which is I suppose why the 2 exist.

    It would still be useful the have the one that executes once as part of a function, unless you can toggle the green arrow?

    I seem to have read somewhere that you can?

    Oh, well no matter.

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