How do I select weapon on touch screen devices

0 favourites
  • 8 posts
From the Asset Store
A set of retro 16-Bit Neon UI elements to make your menus pop!
  • In a wack a mole type game i want to have enemies that get killed only with a specific type of weapon.

    At the bottom of my screen i want to have for ex. 4 icons that represent the 4 different weapons.

    If i touch the 1st one, whenever i touch an enemy, he will get hit by that weapon and if it is the correct one he will die.

    If i touch the 2nd, 3rd or 4th icon, whenever i touch an enemy he will get hit by the 2nd, 3rd or 4th weapon.

    I believe this must be simple but im new here and im a bit confused..

    Thanks in advance..

  • you need to match variables in order to find right weapon.

    create instance or enemy variable, give them different value and same for weapons

    so if a mole comes out with instance variable then tap 2nd weapon and compare mole variable with weapons variable if they equal then kill the mole or else not!

    hope it helps!

  • Thanks for the reply!

    The thing is that i want to tap on weapon 2 to select it, and then, when i tap on the mole, weapon 2 will spawn under my finger,kill the mole and destroy it self.

    Then, whenever i tap a mole, weapon 2 will still spawn (since i have selected it) but if i tap on weapon 1,3 or 4, that other weapon will spawn under my finger whenever i touch the screen in order to kill the differed type o mole...

  • The concept is same ! the only difference is instead of weapon instance variable use global variable and set the variable and use different condition as to reset that as per your requirement. if you can share capx file I can edit and reconstruct it as per your need!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, the capx has only some basic sprites to represent our weapon and emeny sprites so it will be easier for me and others to understand how it will work..

    Again, thank you very much for your help!

    PS The blue and red squares represent the weapons

  • So i guess its a bit more tricky than i thought?

  • Its a 5minute works hope it help!


    if you want to add massive weapon and enemy type i suggest you store in array.

  • Thanks a lot my friend! I will check asap! (im at work right now)

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