How do I move an object after second click?

0 favourites
  • 5 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Hey there,

    I'm new at construct2 and now I have a little Problem...

    I have constructed a little game, where you can choose an item an set it to a figure.

    There is a list of items, created from a family which spawns the items. So I want to click on one item (sprite) and after this click I want to click on one of three slots to place it here.

    The Slots are in a family to.

    My Construct-Part of it looks like this:

    <img src="" border="0" />

    Could anyone help me please?

    All the other functions like spawning the "ItemFrame" to highlight the clicked sprite do fine.

    Thanks forward.


  • Would be a bit easier if you posted .capx file of your game so we could test things and show the solution you :)

    But, it seems like you are not picking an item that you are placing into a slot. I believe that is what you tried to do with 'ident' variable, that is not necessary at all. You can use 'UID' instead, which is Unique IDentifier for every object in game. Save that into 'lastClickedItem' and when clicking on slot, add condition 'select item by UID lastClickedItem'.

    Be sure to check 'Picking'-section in the FAQ for better understanding on how it works! :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi vee41,

    sorry I can't post my .capx-file because the whole sourcecode belongs to my firm and I'm not able to publish that... :/

    I've read the conditions about picking and changed my construct-part like you told me. Now it uses the UID and the item is not moving already... :(

    I'm creating the items in a loop after a AJAX-Request using a switch-case for different types.

    This is an own event and the mouse-function while clicking on a slot is an own event too. So the items had to be there, don't they?

  • Here is a demo the hopefully clears it up a bit.

    Slot demo

    Is this anything like what you are looking for? :)

    It should not matter how you create your items, if they exist when you are clicking them everything should be ok.

  • Oh my God... I'm so... *gnaah* Just had to unpin the items before moving... -_-' oh darn... how awkward...

    Sorry for using your time vee41. :D

    Knowledge about UID and picking helped me through this. Thanks for that!

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