Limiting Movement

Hello... i am developing a checkers game... i haven't started coding because first i want to know its layout...

what i have thought of yet is :


I am going to move the pieces using functions on an 8x8 2D char type array....i wanted to know how to limit and restrct the movement so that one piece can only move diagonally forward only....??
Are you using the Mouse or the Number Pad for input?

You'll see how to limit the users options for movement when you start to code that part of the game. It's pretty simple if you don't want him to do something then don't put in an option to do it.
closed account (zb0S216C)
Here's a wild idea:

Create an 8x8 boolean array. If the element has the value of zero, the player cannot move there. This is the opposite for the value of one.

It's strange, I know.

Wazzak
Last edited on
Object orientated coding. Make each checker it's own object. The 8x8 checker board is an 8x8 array of checker pieces, to display the board, it goes down the list, if that square is not null, it means it has a checker there. When it's time to move, the user selects the square they want to move from. If it has a checker, ask the checker piece where it can move to. The checker piece knows it's own position, and can ask the board if there is a piece at [x][x], and if so, who owns it. So a checker piece at position [0][0] would be bottom left, and would ask the board is there a checker at [1][1]. If yes, do you own it. If no, is there a checker at [2][2]. The checker would then report to your display where it is allowed to move.
thanks for your replies...

@ Computergeek01 ..i am using number pad for input

@ framework...i will try it out ...:)

@ intrexa.....we haven't started object oriented programming yet :(
Topic archived. No new replies allowed.