Destroy on Touch

0 favourites
  • 9 posts
From the Asset Store
Surena Touch
$2.50 USD
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • Hi

    I'm making a game were you basically mine for some gold. Im fairy new to C2 and I need to destroy a object with out destroying all of them.

  • Then you have to understand how events work to pick only the instance you want to disappear.

    As you are mining something, I guess you could pick only the bit of ground that is in touch with the digging tool.

    Or maybe are you using an instance variable and in that case just need to pick the instances by testing which one has a specific value for this variable.

    Hard to tell with your short description.

    At worst, post your capx, it will be easier to provide help.

  • I am in need of a way to destroy one piece of stone with out destroying all of them. Right now all I have in my events sheet is

    Mouse~Double Left Click= Destroy Stone

    I'm not sure if there is a way to destroy just the single stone that the mouse has just double clicked.

  • Assuming your stones are seperate sprites, the condition and action you just described should only destroy the stone that is clicked.

    If you want to destroy the stone after touching it a certain number of times (eg Terraria with a weak pickaxe), you can add a local variable to each type of stone. For example, each "normal stone" could be worth 5.

    Then you create condition:

    Mouse click on stone = subtract 1 from local variable.

    Local variable equal to 0 = destroy object

    Again, as long as your stones are separate instances of the object, only the instance that is being clicked will be affected.

  • Ok Thanks! I didn't have all the stones as different sprites and now I'm off to go change that.

  • You don't need different sprites, but instances.

    Also, instead of the "Mouse:Double click" condition, you should rather use "Mouse:On object clicked" and set it as "Double clicked" and your "Stone" object.

    This will pick ONLY the instance you've just double clicked.

  • Kyatric: I recently found out that its funnier to avoid the 'Mouse' object completly - if possible.

    => using the 'Touch' object => Property: 'Use mouse input' - Yes

    => having both - touch and mouse-click (fallback when the browser doesn't support touch)

    Link to the tutorial Touch

    Pro: Making the whole project browser independent - eg - for the i-devices. Afaik i-devices don't support mouseclick-conditions on sprites,...

    Cons: Mouse over an object and Mousescolling are the only two conditions that are not given by the Touchobject - I think.

    Anything speaking against that or I haven't seen? <img src="smileys/smiley1.gif" border="0" align="middle">

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Joe7: It all depends on what device you aim your game at.

    For my game Drop Da Piew I used both Touch and Mouse, thinking the UI so everything is usable on both Touch and Desktop devices and using the mouse over to add a bit of eye candy when it is supported.

    If you are sure you won't need the specificities of the mouse plugin, yes you can only use the Touch plugin and it makes it very convenient, with the very same code you have the very same behaving on touch and desktop devices.

  • Ok Kyatric, I'l see what works better but i believe that your way will be a lot faster because for the last few hours i have been doing it the way were you incest new sprites for every time i want a new stone or piece of gold.

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