ID:178179
 
How would i make like a turn based code like laser wars but with only two players? heres my queve code:var
gamecontroller/GameCon = new() // The gamecontroller is a global variable called GameCon.

gamecontroller
var
mob/player1
mob/player2
proc
PlayerJoin(mob/M)
if(player1) // Player 1's seat is taken
player2 = M
M << "You are now player 2"
return 2
else if(player2) // Both seats are taken
M << "Sorry, there are already two players playing, you have to watch.."
return 0
else // Player 2's seat is taken
player1 = M
M << "You are now player 1"
return 1

mob
Login()
if(GameCon.PlayerJoin(src))
// Put here what should happen after player joined the game, switching mob for example.
else
// If both seats are taken, do something else here.


ShadowSiientx wrote:
How would i make like a turn based code like laser wars but with only two players? heres my queve code

I see you adopted my example down to every single character. Hopefully there won't be any bugs that you can't sort out because you just copy and pasted the whole code.

To make a turn based game, keep building on the gamecontroller. Set up another variable, "turn" and toggle it between the two player variables in a proc called EndTurn or something. Use clever procs in the gamecontroller and you will notice that making a turn based game is quite simple, especially when it's only a two player game.


/Andreas