1 decade ago by Cedriking
Hello,
It been a while since I've used Impact, now i'm trying to do an online game, in this game I have one entity ( EntityPlayer ) and each player have the same entity, what it's strange is that I'm currently using just 2 players, each player have an unique id. I've created two variables inside the main game, ig.game.player and ig.game.enemy (this.player and this.enemy) and when I first log in with one, I set ig.game.player.id to that id, and when the second player (the enemy) log in, I set ig.game.enemy.id to the enemy id, what it's strange is when I look into my code, both (the enemy and the player) have the same ID after I set the new id to the enemy, they are both EntityPlayer.
How is that possible if I have player and enemy that when I change something to enemy, it's changed also the player variable is changed?
Is there a way that I can have both with EntityPlayer but both aren't the same player or Entity.
Thank you for your help =D
It been a while since I've used Impact, now i'm trying to do an online game, in this game I have one entity ( EntityPlayer ) and each player have the same entity, what it's strange is that I'm currently using just 2 players, each player have an unique id. I've created two variables inside the main game, ig.game.player and ig.game.enemy (this.player and this.enemy) and when I first log in with one, I set ig.game.player.id to that id, and when the second player (the enemy) log in, I set ig.game.enemy.id to the enemy id, what it's strange is when I look into my code, both (the enemy and the player) have the same ID after I set the new id to the enemy, they are both EntityPlayer.
How is that possible if I have player and enemy that when I change something to enemy, it's changed also the player variable is changed?
Is there a way that I can have both with EntityPlayer but both aren't the same player or Entity.
Thank you for your help =D