On mouse click, 3 times?

0 favourites
  • 5 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • I am trying to make a game that compares if the player are doing what the player suppose to do, by doing that, when ever the player click or touch or press key, it'll increment a variable to 1, then I compare this variable to another as a correct variable number.

    eg.

    by click on "something" var player = player + 1.

    set "answer" var answer = int(andom(3)) // let say the answer is equal to 1.

    for every 1 second check

    if player == answer

       score = score + 10

       else

           game over

    what happen is if I press the right key, it'll increment 1, but if I click on the button I have made on screen, it will increment by 3, I don't have a touch screen so I cannot test that. ( click on object "img")

    How do I stop it doing that, it has been a big bug for me.

    the image button I've made has a on state(animation with 1 extra frame). I did try to turn if off, nothing changes

    <img src="smileys/smiley11.gif" border="0" align="middle" />

  • If you provide your .capx then I could try to help you!

  • Did you use the "click" action? How about detecting using on "key up" instead?

    Sounds like Construct2's click implementation detects both key down + key up, and hence the reason for the multiple clicks. Is that true Ashley? I've never ran into this problem, but I think using on key up will solve the problem.

  • Try Construct 3

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

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

    Did you use the "on touched object" event or the "is touching object" event? There's a large difference between the two.

  • Did you use the "click" action? How about detecting using on "key up" instead?

    Sounds like Construct2's click implementation detects both key down + key up, and hence the reason for the multiple clicks. Is that true Ashley? I've never ran into this problem, but I think using on key up will solve the problem.

    Im using "key is pressed"

    vervo

    Did you use the "on touched object" event or the "is touching object" event? There's a large difference between the two.

    Thanks, I realised I set it as "is touching object, now change to on touched object"

    now it increment twice than 3 times.

    <img src="smileys/smiley3.gif" border="0" align="middle" />

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