View Single Post
Old 09-21-2017   #6
Lach's Avatar

You know how you use "for player in players.iterate" to access every player in the current game? That works by telling the game to iterate through every entry in the global table "players" and perform an action for each of them—each entry in "players" stores one set of player_t data. But you can also access individual entries of a table by specifying the index value of the entry that you want to access and/or modify, and the way that you do that is using index numbers such as players[0] to access the first player, players[1] to access the second, players[2] to access the third, and so on. So to change the second player's color in splitscreen mode, you would do it like this instead of with an iteration:

if splitscreen and players[1].mo
    players[1].mo.color = SKINCOLOR_BLUE
Lach is offline   Reply With Quote