2010年12月10日 星期五

2D 飛碟

cannon.position = new Vector2(300, graphics.GraphicsDevice.Viewport.Height - 100);
(砲台位置改變)

if (cannonBallRect.Intersects(enemyRect))
                        {
                            ball.alive =true;
                            enemy.alive = false;
                            score += 100;
                            break;
                        }
(子彈打中飛碟 不會消失)

 foreach (GameObject enemy in enemies)
            {
                if (enemy.alive)
                {
                    spriteBatch.Draw(enemy.sprite,
                        enemy.position, Color.Red);
                }
            }
(飛碟顏色改變)

沒有留言:

張貼留言