Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Implement turns in a game

$
0
0
I created a chess like game for my final project in my Object Orientation class.

Everything is 90% done...game loops and commands move pieces etc...

Only problem is there are supposed to be 2 players that take turn moving their own pieces.

GamePiece class has a int field that is initialized as either 1 or 2, so we can tell if the piece belongs to
player 1 or 2 (player 1 pieces are also capital letters in the text display of the game).

I have a Parser class that takes in inputs, parses words out of the inputted string, checks the words with a list of
commandwords/valid locations, and sends the commands to my Game class to handle them.


Any ideas or hints on how to make the game turn based? I need to make it so the turns go back and forth and whoever's turn it is can only move their own pieces...

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>