Touch another object (when game relies on "is in touch")

  • Hi guys,

    Been a long while since the last time I used Construct (there's now Construct 3!) and I am trying a new project.

    The game uses the "Is in touch" event to move and throw the character around the screen. Now, I have just added a life system and would like players to be able to touch a button on the HUD that can be touched once per level to regain some health. I have all the functions for this working however, due to the "Is in touch" already being used Construct sees this button being pressed as a previous event, flinging the character willy-nilly.

    Is there a way I can disable the original touch input when either that section of the screen or the sprite used is pressed?

    Thanks

  • Simply add another condition to your main "Is in touch" event - "Touch is NOT touching Button".

    If you have lots of HUD buttons, add them all to a family and use "Touch is NOT touching HUDbuttonsFamily"

  • The game does not use any other buttons, heres a screen of the current touch events which can be touched anywhere on screen

  • Select the first event on your screenshot, press "C" and add another condition:

    Touch is NOT touching RechargeHealthButton

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks dop - I forgot about other touching conditions so adding it to the first event didn't work. I have added the is not in touch to the other events using touch and it seems to have worked! I may not need one or two of them, could you just check this screen shot? Cheers again.

  • Looks good to me!

  • Dop, could I share my capx with you for you to see? I was just trying to add a teleport to sprite based on one of your other threads and when I came to test all the two buttons (i tried to family them) stopped working. I then removed all the events i had just made and still the same issue, healthboostbutton not working, and now getting a sound loop issue on game over screen.

    Even tried to remake on a fresh capx and getting same end result for some reason! It was working before 😭

  • You can find my email in this post

  • Managed to find the fix.. its because i was working on Windows. I have been doing most of the development on Chromebook and phone, and C3 recognises Chromebooks as touch, hence why the buttons were working on that and not on Windows. However, still have the game over audio loop to fix, if i cant find the solution i'll email you. Cheers

  • Fixed the loop.

    0 life was causing the call function "gameover" to repeat constantly. Added 1 to life after and problem solved. This an ok way of doing it or a bit of a bodge job?

  • This an ok way of doing it or a bit of a bodge job?

    No, it's not an ok way of doing it.. Add "System trigger once" condition to "Life<=0".

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