PDA

Click to See Complete Forum and Search --> : Simple game, complex programming... please see...


Dreamlax
May 9th, 2001, 04:47 AM
There was a game I played once, played on a chess board. You have 8 rooks, and in order to remove pieces, you had to surround it. Here's an example. * is one side and # is the other:


This is a capture
* | * | * | | * | * | * | *
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
| | # | * | # | | |
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
# | # | | # | | # | # | #

This would also be a capture
* | * | * | | * | * | * | *
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
| | | # | | | |
---|---|---|---|---|---|---|---
| | | * | | | |
---|---|---|---|---|---|---|---
| | | # | | | |
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
# | # | | # | | # | # | #

And so is this
* | * | * | | | * | * | *
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
| | # | * | * | # | |
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
| | | | | | |
---|---|---|---|---|---|---|---
# | # | | # | # | | # | #


You can't jump over pieces either.

Anyway, I've sorted out the movement of the pieces (in programming), but when you select a piece, I would like a shape (taking up one square) on the X or Y axis if the X,Y coordinates of the mouse are closer to the axis.

It's hard to explain, but if the mouse is closer to the Y axis, the shape would snap to the Y axis, and if the mouse moves closer to the X axis (than it is to the Y axis) it should snap there.

You 'COULD' have a look at the game I have so far, but if you don't like reading uncommented and 1-space-nesting programs, you shouldn't really. The reason why it is called Granddad's Game is because the game is for him... You also might find a lot of one-line functions but that's because it looks nicer (I'm Mr. Cosmetic).

Any help would be.... y'know..... appreciated.