Silex's Forum Posts

  • 2 posts
  • Hey guys! Thanks for your answers !

    In the end I couldn't manage to make it work the way you told me(I don't know if I did it badly or if it just doesn't work), but it inspired me to "cheat" a little: I created a "base" and whenever you click a pawn, it destroys itself and spawns the "base" under the click. If dropped on another pawn it will work since it's not the same object, and if it's not placed on another pawn, the base is destroyed and the game spawns a normal pawn where you started the dragging. It works fine, even though there's a lot of destroy/creating haha.

    However, thanks for the fast answers. You guys rules !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello guys !

    It's hard to describe in the title, but it's not that hard to understand.

    Take a look at the following image:

    As you can see, i'm trying to use the drag and drop behavior. It's a simple game I'm trying to make: when you move and drop a pawn on another one, it will destroy it and start another animation with a 2 on it (thus implying that you've put your pawn on the other). You can do that with the yellow pawn (Pion_jaune) and the red pawn (Pion_rouge) on any other pawn (which mean I can drop a red pawn on a red or on a yellow one, and a yellow on a red or a yellow one too)

    Whenever I pick one, I register their coordinates in "jx, jy", and then I calculate its distance to the one that gets "dropped on". If it's to far away, the moving pawn gets back to its initial position, and nothing happen. (thus the "else" condition)

    It works perfectly fine when I'm dropping the yellow one on the red one.

    But then, things gets harder...

    When I use the same code for the yellow drop on the yellow, it doesn't work.

    And I know why it does'nt work, it's obviously because construct doesn't make the difference between the one that is dragged and dropped and the one that gets "dropped on". It's also hard for it when I'm calculating the distance, because I don't know which "Pion_jaune.X"/"Pion_jaune.Y" it takes : the one I'm dragging or the one i'm dropping the pawn on?

    So, to sum up everything, I need to tell construct which one is the one that I'm dragging and dropping, and which one I'm dropping my pawn on

    The problem is, there will be a lot of pawn and a lot of global conditions applied to them. I really can't afford to use UID and make conditions on every single ones of them, because I'm going to collapse during the work haha.

    Sorry if I made mistakes, English is not my main langage (I'm French, if you ever wonder )

    Thank you for taking time to help others, it means a lot to me

  • 2 posts