touching object displays message

0 favourites
  • 5 posts
From the Asset Store
Surena Touch
$2.50 USD
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • On my game there are keyboard shortcuts to go different places in my game, so I made a keyboard on the instruction page and I want to touch a key and while touching that key the description of that shortcut display above the keyboard on the instruction page then I touch a different key and above I see the description of that shortcut

    I figured out the touch/is touching/key and then UID#

    I am stuck on what to do next

    Life is a game with infinite possibilities enjoy and share

  • Try having a dedicated text object that changes position/text/visibility depending on what key is pressed

  • I setup a project to test this out

    A couple of troubles I'm having

    The A works but not the D and I can't figure out why

    The other thing is it takes a long time to display the shortcut description

    drive.google.com/drive/folders/14Yr0wuXsyOZaUo3GvPPIS8Iron5-ULcl

    Any thoughts?

  • Hi,

    The reason D isn't showing is because you've got all those other D keys on screen - all of those are triggering as not being touched so D remains invisible.

    The slow response is due to using the "is touching" and "is not touching" conditions; these will be constantly adding or subtracting from your global variables every tick. Instead you want to use "on touch" and "on touch ended" so that they only trigger once when an inputs starts or ends.

    I've attached two alternative ways of arranging the events to solve this:

    revised keeps your existing objects but sets the triggers so they only fire when touch starts and ends. I've also removed the unnecessary global variables.

    revised2 uses more advanced concepts but simplifies the events even further; there is only a single letter text object, which is placed in a container with the key sprite object, and a single shortcutDescription text object (placing the key-text and key-sprite in container together means that when either instance is picked its container buddy is also picked).

    The key sprite object has two string variables - one for the letter text, the other for the shortcut.

    At the start of the layout the key text is set.

    When you press a key it sets the shortcutDescription text to key.shortcutText.

    dropbox.com/s/lm1it6mn37l30gy/touching%20object%20display%20message%20revised.c3p

    dropbox.com/s/ifcr3s20vj8xaup/touching%20object%20display%20message%20revised2.c3p

  • Try Construct 3

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

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

    Cheers

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