私は小さな学校プロジェクトのためにVisual Studio 2015 C#でflappybirdを再作成しようとしています。しかし、何らかの理由で私はこのエラーを受け取り、私は本当に修正できません。私はflappybirdを作成する方法についてのチュートリアルに従っていますが、チュートリアルを作成している人は、VB.netのHeres the YT Linkと私のコードの下に作ろうとしています。パイプがあるものの https://www.youtube.com/watch?v=tnjdMbdEzMoc#Flappybird "メソッドのように呼び出すことのできないメンバーは使用できません"
public partial class Form10 : Form
{
int gravity = 1;
int yspeed = 0;
PictureBox[,] Pipe;
public Form10()
{
InitializeComponent();
}
private void gameTimer_Tick(object sender, EventArgs e)
{
int i;
this.yspeed += this.gravity;
bird.Top += this.yspeed;
}
private void inGameKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Space)
{
this.yspeed = -15;
}
}
private void pausePlayToolStripMenuItem_Click(object sender, EventArgs e)
{
if (gameTimer.Enabled == true)
{
gameTimer.Enabled = false;
}
else
{
if (gameTimer.Enabled == false)
{
gameTimer.Enabled = true;
}
}
}
private void restartToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void startGame_Click(object sender, EventArgs e)
{
if (gameTimer.Enabled == false)
{
gameTimer.Enabled = true;
startGame.Enabled = false;
}
}
private void CreatePipes(int number)
{
int i = 0;
for (i = 0; (i <= number); i++)
{
var temp = new PictureBox();
this.Controls.Add(temp);
temp.Width = 50;
temp.Height = 370;
temp.BorderStyle = BorderStyle.FixedSingle;
temp.BackColor = Color.Red;
temp.Top = 50;
temp.Left = (2 * 200) + 300;
Pipe(i) = temp;
Pipe(i).Visable = true;
}
}
private void Form10_Load(object sender, EventArgs e)
{
gameTimer.Enabled = true;
CreatePipes(1);
}
}
}
エラーが発生した行はありますか。 –
おそらく 'Pipe(i)'にあります。 'Pipe'は2次元配列なので、' Pipe [x、y] 'のようなものでなければなりません。' x'と 'y'は次元に依存しますが、' Pipe' 。 –
VB.NETとC#の構文が混在しています。 –