iDevGames Forums
Rotating around a piece in a board game - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Design (/forum-5.html)
+--- Thread: Rotating around a piece in a board game (/thread-3505.html)



Rotating around a piece in a board game - StealthyCoin - Feb 10, 2007 02:58 PM

Got a board game I am working on for the heck of it, its pretty simple.

I have different colored pieces, the way you move is by clicking on one of your pieces, depending if its a right click or a let click I want all the surrounding pieces to rotate one square CW, or CCW.
Thats all dandy, but every time I start to code it I run into special cases I cant figure out for some reason, like if it is completly surrounded by pieces, none of the pieces will move because they will collide on their first attempt at updating. I would have to move them all simotaniously.

Im not sure I made that clear enough Annoyed


Rotating around a piece in a board game - maximile - Feb 10, 2007 03:10 PM

Could you use a 'before' state and an 'after' state? So if you had an array representing the board, you'd calculate each piece's new position and write it to the 'after' array. Then when you've done that for every piece, you can replace the 'before' with the 'after'. Or animate from one to the other.

Or am I misunderstanding your problem?


Rotating around a piece in a board game - StealthyCoin - Feb 10, 2007 03:23 PM

maximile Wrote:Could you use a 'before' state and an 'after' state? So if you had an array representing the board, you'd calculate each piece's new position and write it to the 'after' array. Then when you've done that for every piece, you can replace the 'before' with the 'after'. Or animate from one to the other.

Or am I misunderstanding your problem?


No you understand it. Not sure why I didn't think of that at all, maybe since im playing super smash bros at the same time? Not storing it in a 2d array though, so Ill just make a destination x/y position variable, thanks.