Click does multiples actions

Discussion in 'Programming' started by Fabseven, Aug 29, 2017.

Tags:
  1. Fabseven

    Fabseven Member

    Joined:
    Oct 7, 2016
    Posts:
    350
    Hello there

    Given you have multiple obj on the screen (draw in draw gui or draw)
    How do you manage to execute only one action on a click on obj with the same location ? (or click box)

    In my case when i click a tower (it's a tower defense game)
    A gui layer display options and you can upgrade the tower but ithere is another tower under the upgrade button.
    So if you click on the button the tower will upgrade and after that you selecte the other tower, it's kind of a pain ?

    Should i manage this with an alarm ? (set some alarm value to a low value like 1 or 2 and donot take actions if this alarm > 0 ?)
     
  2. Jakylgamer

    Jakylgamer Member

    Joined:
    Jun 27, 2016
    Posts:
    510
    make it so that you cant interact with the tower if the upgrade button is showing
    like
    Code:
    if !instance_exists(obj_upgrade_button) {
       if mouse_check_button_pressed(mb_left) {
          //upgrade stuff
       }
    }
    
     
  3. Fabseven

    Fabseven Member

    Joined:
    Oct 7, 2016
    Posts:
    350
    ok i will try this, could do the trick
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice