public void Execute() { int A = 25; //your pokemons speed int B = 50; //other pokemons speed int F = (((A * 128) / B) + 30 * escapeCount) % 256; int rnd = RandomExtension.NextInt(rndNum, 0, 255); if (rnd < F) { game.transition = true; game.gameState = new PlayingGameState(game); } escapeCount++; }
public void Update(GameTime gameTime) { if (!talkedTo) { Random rnd = new Random(); int value = RandomExtension.NextInt(rnd, 0, 100); if (value == 0) { value = RandomExtension.NextInt(rnd, 0, 3); if (value == 0) { state.Up(); } else if (value == 1) { state.Down(); } else if (value == 2) { state.Left(); } else { state.Right(); } } state.Update(gameTime); } else { textBox.Update(gameTime); if (textBox.complete == true) { talkedTo = false; } } }