/// <summary>
 /// The constructor of the class.
 /// </summary>
 /// <param name="hero">the object ypu want to follow</param>
 /// <param name="vp">the size of the window you want to look through</param>
 public FrameOfView(MoveableObject hero, Viewport vp)
 {
     this.hero         = hero;
     this.vp           = vp;
     Zoom              = 0.8f;
     Game1.UpdateThis += UpdateThis;
 }
示例#2
0
        public Coin(MoveableObject player, Character c, State s, Vector2 position, Color color,
                    float rotation, float scale, SpriteEffects effects, float layerDepth)

            :   base(c, s, position, color, rotation, scale, effects, layerDepth)
        {
            this.Player = player;
            G.CoinQueue.Enqueue(this);
        }
示例#3
0
        /// <summary>
        /// The constructor for the Enemy. in addition to all the nececetys for a frame,
        /// It Tekes the Playe, So It Can Track Its Movment.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="keys">A st of Keys so that the Ai can control the Enemy. </param>
        /// <param name="c"></param>
        /// <param name="s"></param>
        /// <param name="position"></param>
        /// <param name="color"></param>
        /// <param name="rotation"></param>
        /// <param name="scale"></param>
        /// <param name="effects"></param>
        /// <param name="layerDepth"></param>
        public AiEnemy(MoveableObject player, ControlsAi keys, Character c, State s, Vector2 position, Color color,
                       float rotation, float scale, SpriteEffects effects, float layerDepth)

            :  base(c, s, position, color, rotation, scale, effects, layerDepth)
        {
            this.Keys   = keys;
            this.Player = player;
        }
示例#4
0
        protected override void LoadContent()
        {
            //Loading all the different Textures into The Objects.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //The "activation" of the G class.
            G.Init(Content, spriteBatch, graphics);
            //Loading the G class with the mask Collision background
            G.map = new Map(G.cm.Load <Texture2D>("LvlMask"));


            StartScreen   = G.cm.Load <Texture2D>("StartScreen");
            GameOver      = G.cm.Load <Texture2D>("GameOver");
            VictoryScreen = G.cm.Load <Texture2D>("VictoryScreen");

            BackG = new CanBeDrawn(G.cm.Load <Texture2D>("GameLvl"), Vector2.Zero, null, Color.White,
                                   0f, Vector2.Zero, G.Scale, SpriteEffects.None, 0f);



            a = new MoveableObject(new ControlsPlayer(Keys.A, Keys.D, Keys.W, Keys.S)
                                   , Character.Hero, State.Stand, new Vector2(220 * G.Scale, 200 * G.Scale)
                                   , Color.White, 0f,
                                   G.Scale - 2.5f, SpriteEffects.None, 1f);

            //Enemy 1 location.X = 1500


            Enemy = new AiEnemy(a, new ControlsAi(false, true, false, false), Character.Enemy, State.Walk,
                                new Vector2(300 * G.Scale, 286 * G.Scale)
                                , Color.White, 0f,
                                G.Scale - 3.4f, SpriteEffects.None, 1f);

            Enemy2 = new AiEnemy(a, new ControlsAi(false, true, false, false), Character.Enemy, State.Walk,
                                 new Vector2(1600 * G.Scale, 286 * G.Scale),
                                 Color.White, 0f, G.Scale - 3.4f, SpriteEffects.None, 1f);

            Enemy3 = new AiEnemy(a, new ControlsAi(false, true, false, false), Character.Enemy, State.Walk,
                                 new Vector2(1860 * G.Scale, 286 * G.Scale),
                                 Color.White, 0f, G.Scale - 3.4f, SpriteEffects.None, 1f);

            Enemy4 = new AiEnemy(a, new ControlsAi(false, true, false, false), Character.Enemy, State.Walk,
                                 new Vector2(2100 * G.Scale, 286 * G.Scale),
                                 Color.White, 0f, G.Scale - 3.4f, SpriteEffects.None, 1f);

            Enemy5 = new AiEnemy(a, new ControlsAi(false, true, false, false), Character.Enemy, State.Walk,
                                 new Vector2(2650 * G.Scale, 286 * G.Scale),
                                 Color.White, 0f, G.Scale - 3.4f, SpriteEffects.None, 1f);

            C1 = new Coin(a, Character.Coin, State.Stand,
                          new Vector2(685 * G.Scale, 200 * G.Scale),
                          Color.White, 0f, G.Scale, SpriteEffects.None, 1f);

            C2 = new Coin(a, Character.Coin, State.Stand,
                          new Vector2(1438 * G.Scale, 216 * G.Scale),
                          Color.White, 0f, G.Scale, SpriteEffects.None, 1f);

            C3 = new Coin(a, Character.Coin, State.Stand,
                          new Vector2(1884 * G.Scale, 264 * G.Scale),
                          Color.White, 0f, G.Scale, SpriteEffects.None, 1f);

            C4 = new Coin(a, Character.Coin, State.Stand,
                          new Vector2(2518 * G.Scale, 142 * G.Scale),
                          Color.White, 0f, G.Scale, SpriteEffects.None, 1f);

            C5 = new Coin(a, Character.Coin, State.Stand,
                          new Vector2(3300 * G.Scale, 224 * G.Scale),
                          Color.White, 0f, G.Scale, SpriteEffects.None, 1f);


            //Crating the Camera that will follow an Object.
            cam = new FrameOfView(a, new Viewport(0, 0, 2000, 1600));
        }