Pick & move an object on chessboard

0 favourites
  • 9 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Hi all,

    we don?t know how to pick an object based on a specific criteria.

    We have seen in many examples, how to pick an instance ? but on that way we can?t assign the move to another object action.

    In this simple example we first would like to pick one of the objects (A, B or C) and move it to overlap with another one:

    fluidworkshop.com/board/board_test.capx

    Since later on we would like to extend the number of objects, we would like to write a general rule and then just pick the object to move, and the other one to move to, and apply the complex rules to them.

    Any suggestions? <img src="smileys/smiley1.gif" border="0" align="middle" />

    Many thanks!

  • I can't open the capx file you gave. There's an error message:

    <img src="http://dl.dropboxusercontent.com/u/3132932/DropShorty/Untitled.png" border="0" />

    tinyurl.com/m6hfnu3

  • You can install Rex Rainbow's plugins easily:

    scirra.com/forum/app-yetanother-construct-2-repository-beta_topic52050.html

  • Any idea please? <img src="smileys/smiley5.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
  • I don't like installing plugins. So don't know what your capx looks like. I presume you want to drag piece to overlap another peice. you can do this with behaviors.

    I suggest you read the manual about behaviours.

    On sprite right click choose behaviours then press plus sign. Find drag and drop. Now piece should be able to move.

    Overlapping is easy. Create event with sprite is overlapping with another object. Select object.

    I would read manual about families etc. In fact I would read manual in entirety and use the build in examples as source. Open select desired example to view source.

    Edit: there is a checkers game somewhere I just tried to look, but don't have it bookmarked. Search the forum / tutorials / arcade. Can't remember where it was. It has drag and drop if I am not mistaken.

  • I like Rex plugins, but I'm always hesitent to install his. He makes great plugins. But I find they are often linked to other plugins. Board can't be used without his SquareTx/OrthoTx plugin. Not only that Matcher, InGroup, Board are all linked together.

    While this is cool. It clutters up the work space. I think personally Rex needs to compress his plugins a lot more. Board should have matcher and the shapes built in. so on etc.

    But to be honest. Rex is a smart guy. He does this because it's a good way for him to generate work. it's great that he releases stuff for free including many CAPX that I notice people build off of rather than learning C2 or programming themselves.

    But at the OP. I suggest if your going this path. just hire Rex to do some work. he will get the work done faster and save a lot of grief for you and everyone who helps(except Rex :D)

    and also why are you using RexRainbow Function? C2 has a native Function plugin already!

  • Thanks for responses.

    We use Rex plugins because they cover most of the functions we need for a board game. But our problem is not based on these functions.

    The question is, how to make a chess selected and moved in a turn-based mode?

    One turn: the first click picks a chess, and the second click on an empty tile moves it. But how to make a chess picked?

    That mentioned chess source code would be very useful, but we found only a Construct1 version of it.

    Sorry if we ask something trivial.

    What do you think? <img src="smileys/smiley1.gif" border="0" align="middle" /> Thanks!

  • Give the object a boolean variable

    on object clicked set set boolean to true

    on tile clicked if boolean is true move to tile

    on arrived set boolean to false.

  • Thanks, we make a try...

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