| Author |
Message |
Eduardo Loureiro Jr. (Eloureiro)
| | Posted on Tuesday, January 21, 2003 - 5:28 pm: | |
Hi, I'm making my first game and I'm having a problem with captures. I want a capture to take place when there's an enemy at one direction (for example, "se") and a friend at the opposite direction ("nw"). I've made with: (if (and (enemy? $1) (friend? (opposite $1))) (capture $1) ) The problem is: The game considers the piece which is moving as a friend in the opposite direction. For instance, player A has a piece at e4 and player B has pieces on e6 e g6. I don't want B to capture A by moving from g6 to f5 (since there would be no friend of B in g6 anymore). If B wants to capture A, I want him to move only from e6 to f5 (then a enemy will be at "sw" and a friend will be at the opposite direction at "ne"). How can I reject this movement (g6-f5) as a capture movement? (I want it to be a valid movement, but not a capture movement.) Thanks in advance, Eduardo |
Jeff Mallett (Jeffm)
| | Posted on Wednesday, January 22, 2003 - 12:55 am: | |
The most efficient way is to not call your logic for the forward direction. For example, for the "nw" move, only call your capture macro for the "ne" and "sw" directions (assuming pieces move diagonally like checkers). An alternate way is to actually put a check in your logic to see if the friend piece is on the position you just came from. For example, if you used "mark" on the start square, then you could this addition condition to your "and": (not-marked? (opposite $1)) |
Eduardo Loureiro Jr. (Eloureiro)
| | Posted on Wednesday, January 22, 2003 - 3:40 pm: | |
Thanks, Jeff! I've made it with your "mark" suggestions. Altough I had to fight a little trying to guess how to "use mark on the start square". Cheers, Eduardo |
|