エラーが発生します。
「エラー 1 'GameStateManagement.GameplayScreen.Draw(Microsoft.Xna.Framework.GameTime, GameStateManagement.InputState)': オーバーライドする適切なメソッドが見つかりません」
何が悪いのかわかりません。私はプログラミングが初めてで、大学のコースからいくつかのコードを与えられました。残りは自分でやった。途方に暮れています。この問題を解決するにはどうすればよいですか?
コード
/// Draws the gameplay screen.
/// </summary>
public override void Draw(GameTime gameTime, InputState input)
{
// This game has a blue background. Why? Because! Not anymore, haha!
var colorMatch = new Dictionary<int, Color>();
colorMatch.Add(1, Color.LightBlue);
colorMatch.Add(2, Color.CornflowerBlue);
colorMatch.Add(3, Color.Blue);
colorMatch.Add(4, Color.White);
colorMatch.Add(5, Color.LightGreen);
colorMatch.Add(6, Color.Green);
colorMatch.Add(7, Color.Purple);
colorMatch.Add(8, Color.Chocolate);
colorMatch.Add(9, Color.Crimson);
colorMatch.Add(10, Color.IndianRed);
ScreenManager.GraphicsDevice.Clear(ClearOptions.Target,
colorMatch[munchieSpeed], 0, 0);
spriteBatch.Begin();
// Draw munchies
int playerIndex = (int)ControllingPlayer.Value;
KeyboardState keyboardState = input.CurrentKeyboardStates[playerIndex];
GamePadState gamePadState = input.CurrentGamePadStates[playerIndex];
for (int i = 0; i < noOfMunchies; i++)
{
if (munchieAnimationCount[i] == 0)
{
// Draw frame 1
if ((gamePadState.DPad.Right == ButtonState.Pressed) ||
(keyboardState.IsKeyDown(Keys.Right)))
{
spriteBatch.Draw(right, munchiePos[i], Color.White);
}
if ((gamePadState.DPad.Left == ButtonState.Pressed ||
(keyboardState.IsKeyDown(Keys.Left))))
{
spriteBatch.Draw(left, munchiePos[i], Color.White);
}
else if ((gamePadState.DPad.Up == ButtonState.Pressed ||
(keyboardState.IsKeyDown(Keys.Up))))
{
spriteBatch.Draw(up, munchiePos[i], Color.White);
}
else if ((gamePadState.DPad.Down == ButtonState.Pressed ||
(keyboardState.IsKeyDown(Keys.Down))))
{
spriteBatch.Draw(down, munchiePos[i], Color.White);
}
}
else
{
// Draw frame 2
spriteBatch.Draw(left_2, munchiePos[i], Color.White);
}
}
// Draw Pacman
spriteBatch.Draw(pacman, pacmanPos,
new Rectangle(currentFrame.X * frameSize.X,
currentFrame.Y * frameSize.Y,
frameSize.X,
frameSize.Y),
Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0);
spriteBatch.End();
// If the game is transitioning on or off, fade it out to black.
if (TransitionPosition > 0 || pauseAlpha > 0)
{
float alpha = MathHelper.Lerp(1f - TransitionAlpha, 1f, pauseAlpha / 2);
ScreenManager.FadeBackBufferToBlack(alpha);
}
//Draw Score
DrawText(points.ToString());
}
//Draw Scores
private void DrawText(string score)
{
var CourierNew = content.Load<SpriteFont>("Fonts/menufont");
spriteBatch.Begin();
spriteBatch.DrawString(CourierNew, "Score: " + score, new Vector2(25, 0), Color.Black);
spriteBatch.DrawString(CourierNew, "Lives: " + lives, new Vector2(700, 0), Color.Black);
spriteBatch.End();
}
#endregion
}
}