Chess Capturing

Show us your works in progress and request feedback

Post » Fri Aug 29, 2014 4:02 pm

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.
You do not have the required permissions to view the files attached to this post.
B
7
S
1
Posts: 6
Reputation: 1,479

Post » Fri Aug 29, 2014 4:25 pm

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.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Fri Aug 29, 2014 4:52 pm

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.
B
7
S
1
Posts: 6
Reputation: 1,479

Post » Sun Aug 31, 2014 10:40 pm

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)
B
15
S
5
G
7
Posts: 876
Reputation: 5,650

Post » Mon Sep 01, 2014 12:19 am

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.
B
7
S
1
Posts: 6
Reputation: 1,479

Post » Mon Sep 01, 2014 1:05 am

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"?
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Mon Sep 01, 2014 5:03 am

I've restarted it almost from scratch using arrays... And I've handled the Castling successfully :)
B
7
S
1
Posts: 6
Reputation: 1,479

Post » Sun Feb 15, 2015 3:27 pm

yes nice work man really hard work ;)
B
15
S
4
G
1
Posts: 64
Reputation: 10,842


Return to Works in Progress/Feedback Requests

Who is online

Users browsing this forum: No registered users and 2 guests