Generation

generate functionSat, 28 Jan 2023

generate a function for losing player items at death

public void lostItems(int numItems) { Random rand = new Random(); int goldLost = rand.Next(0, numItems); int itemsLost = rand.Next(0, numItems); int xpLost = rand.Next(0, numItems); int hpLost = rand.Next(0, numItems); string message = "You lost: " + goldLost + " gold, " + itemsLost + " items, " + xpLost + " xp, and " + hpLost + " hp."; Console.WriteLine(message); }

Questions about programming?Chat with your personal AI assistant