How do I set a variable on when touching an object?

  • My idea is that when the player is touching a wall, they'll be able to perform a wall jump. To implement this, I'm using a global variable which, when set at >0, will allow the player to wall jump. The problem I'm having is I can't find a way of dynamically changing the variable based on whether the two objects are colliding. If I set the player to 'on collision with wall' then the variable is stuck at value 1, since I can't find a way to change it back to 0 using another condition, nor can I use an 'else' statement. I tried 'is overlapping with' but that didn't seem to do anything. Anyone got ideas on how I can do this?

    All help appreciated!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use 'is overlapping with offset'. This enables you to use an else.

    When the wall is to the right the offset should be -1, and to the left 1.

  • To go back to value 0 you can inverse a condition by hitting i on your keyboard

    Choose the condition "Is overlapping" wall then hit i.

    The action would be set global variable to 0

  • You can use 'is overlapping with offset'. This enables you to use an else.

    When the wall is to the right the offset should be -1, and to the left 1.

    This works perfectly and was exactly what I was looking for! Thanks a lot man!

  • Ok, all solved.

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