Chess Capturing

0 favourites
  • 7 posts
From the Asset Store
Creating Artificial Intelligence Games Using Construct2 and Construct3.
  • I'm developing this chess game for practing purposes... I'm having a hard time to "Capture a Piece". I'm gonna show you a piece of events that handles the movement with and without capturing (not, working though).

    If you want to check the game it's under SCIRRA arcade/example/17703/claucometa-chess

    I'm sending the Project altogether.

    The problem is that the Event "Minion overlapping minion" is not occurring.

  • Objects overlapping themselves are a tricky issue, what I would suggest is to work inside an array of values rather than the physical pieces themselves (since chess state can be represented as the position of each piece on the board +some other factors), so when you move a piece over a cell, you verify the value of the cell itself.

  • Thx.. I'm not using arrays (free version) but the idea you gave me might work... I will set an instance variable to the square... indicating busy (white or black piece) or empty. Thx.

  • The reason your code didn't work is because you're comparing 2 instances of the same type. To get around that, you can either "pick instance x" x=0 being the 1st instance, and x=1 being the 2nd. Or put the instances into a family, then you can compare the family with the instance... so it'd be like "if MinionFamily OVERLAPS Minion then..."

    But yeah, arrays will work for this but will require you to change a lot of your code and if you haven't used them before, or have little experience with arrays in general, then you'll have a big hill to climb.

    EDIT> Just realised you're using the free version. Families are a no-go then but my first suggestion will work (pick instance x)

  • Thank You for Your Reply. I'm changing all the work To Arrays Just figured out that it makes my life a lot easier to make the movements. And even avoid some bugs.

  • I can attest to arrays making it easier. Especially if you want a way to see if the kings are in check. I also recommend using the function object too. It can help you eliminate redundant events and keep you below the 100 event limit for the free version.

    Do you think you'll support more exotic moves like "en passe" and "castling"?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've restarted it almost from scratch using arrays... And I've handled the Castling successfully

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