我试图让外星人与射手相交,当相交发生时,我想退出游戏。但是,它们直接通过底部的射手,甚至没有执行代码
这是我的代码:
Rectangle rectlauncher = new Rectangle(launcherXPos, 720, launcherImg.Width, launcherImg.Height);
Rectangle rectinvader = new Rectangle(invaders[Count].GetXPos(), invaders[Count].GetYPos(),invaderImg.Width, invaderImg.Height);
if (rectinvader.Intersects(rectlaucher))
{
this.Exit();
}
代码值:
launcherXPos = 512;
invaderDirection = -1;
invaderSpeed = 20;
invader = new invader[55]; //displays the number entered of 'invaders'
int XPos = 512;
int YPos = 100;