コード例 #1
0
ファイル: Boss.cs プロジェクト: negelvovich/SPACEWAR
        public void MoveToTarget(SpaceShip target)
        {
            float angle = (float)Math.Atan2(target.Y - Y, target.X - X);

            X += (float)(Speed * Math.Cos(angle));
            Y += (float)(Speed * Math.Sin(angle));
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: negelvovich/SPACEWAR
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            MyContent   = Content;

            // TODO: use this.Content to load your game content here

            background = Content.Load <Texture2D>("BlackSky");
            spriteFont = Content.Load <SpriteFont>("Text");
            Texture2D texture = Content.Load <Texture2D>("SmileyWalk");

            //animatedSprite = new AnimatedSprite(texture, 4, 4);
            spaceBackground = new SpaceBackground(
                graphics.PreferredBackBufferWidth,
                graphics.PreferredBackBufferHeight,
                100,
                new Texture2D[] {
                Content.Load <Texture2D>("blue2"),
                Content.Load <Texture2D>("blue3"),
                Content.Load <Texture2D>("yellow"),
                Content.Load <Texture2D>("white"),
                Content.Load <Texture2D>("white"),
                Content.Load <Texture2D>("white"),
            }
                );
            arrayOfBosses.Add(new Boss(0, 0, Content.Load <Texture2D>("Cat"), 0.2f, 5f, 90f));
            arrayOfBosses.Add(new Boss(0, 1000, Content.Load <Texture2D>("ZLR2nRL5huk"), 0.2f, 5f, 90f));
            spaceBackground.StarsGenerate();

            blue  = Content.Load <Texture2D>("blue");
            green = Content.Load <Texture2D>("green");
            red   = Content.Load <Texture2D>("red");

            ShellTexture = Content.Load <Texture2D>("s120014250");

            shuttle = new SpaceShip(
                graphics.PreferredBackBufferWidth / 2,
                graphics.PreferredBackBufferHeight / 2,
                Content.Load <Texture2D>("shuttle"), ShellTexture, arrayOfShells, 0.5f, 600f, 150f, 90f);

            animeGirl = new Entity2D(
                graphics.PreferredBackBufferWidth / 2,
                graphics.PreferredBackBufferHeight / 2,
                Content.Load <Texture2D>("s120014250"), 0.05f, 0f);


            this.song = Content.Load <Song>("Kyle Richards - Wave Fight 5");
            MediaPlayer.Play(song);
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume      = 0.0f;
        }