I'm trying to make a game in which two players engage in a fight and press a button on the screen to deal damage to each other. The damage that a character can deal should be a random number between 1 and 10. The damage that the attacked character receives should be the same random number.
The game is to be playable on both Android and iOS (Java and Swift) but how do I ensure that the same random number is generated for damage dealt and damage received? I realize that I could send the damage dealt to the attacked player and have that amount deducted from their health, but I was wondering if there was a way to generate the same sequence of random numbers in Java and Swift so that I wouldn't have to go through a server.
Aucun commentaire:
Enregistrer un commentaire