"Is touching object" not working as intended?

0 favourites
  • 6 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hi. The example I used had Keyboard is down to lower the speed.

    I added touch controls and used Is touching object for a brake button. But it does not do anything if I touch and hold the button. But it should break as long as I touch it? Its no single trigger?

    Example Code:

    + Keyboard: ↓ is down

    -> glob: Set roadSpeedMod to clamp(Self.roadSpeedMod + 256×dt,Self.roadSpeed÷6,(Self.roadSpeed÷4)×3)

    + Touch: Is touching BrakeButton

    -> glob: Set roadSpeedMod to clamp(Self.roadSpeedMod + 256×dt,Self.roadSpeed÷6,(Self.roadSpeed÷4)×3)

    Tagged:

  • Just tried

    | Global number boxspeed‎ = 5

    + (no conditions)

    -> Sprite: Rotate boxspeed degrees clockwise

    + Touch: Is touching Sprite

    -> System: Subtract 0.1 from boxspeed

    works as expected - box slows down then goes anticlockwise. Must be something else in your events.

  • Thanks for trying! I think I have just found the problem. The line

    + Keyboard: [X] ↓ is down

    -> glob: Set roadSpeedMod to 0

    seems to negate it. After disabling the touch code worked. :)

    Just need to find a way to make it work now. When I just use touch it works but not in combination with keyboard.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • + Keyboard: [X] ↓ is down

    just make this trigger once or change to on key released.

    (otherwise it is firing all the time making your speed 0)

  • Keyboard: ↓ is down

    OR

    Touch: Is touching BrakeButton

  • Thanks for your replies. :)

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