/// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            this.IsMouseVisible = true;

            // Initialize the player class
            player = new Player();
            playerSword = new Weapon();
            camera = new Camera();

            //enemy = new Player();


            collisionSolids = new List<EnvironmentSolid>(); // deprecate
            collisionAreas = new List<BoundingRect>();
            floor = new EnvironmentSolid();
            tower1 = new EnvironmentSolid();

            collisionSolids.Add(floor);
            collisionSolids.Add(tower1);


            debugBoxesOn = false;
            editorModeOn = false;

            currentScreen = new int();
            currentScreen = 0;
            //screen = new Screen();
            screens = new List<Screen>();

            base.Initialize();
        }
예제 #2
0
        // vvvvvvvvvv TRASH vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

        //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


        public void Initialize(NinjaGaiDemake_Game game, Texture2D a_texture, Vector2 a_position, Weapon a_sword)
        {
            // temp
            color = Color.White;
            scale = 0.4f;

            IsAlive = true;
            health = 15;

            this.game = game;

            // set texture // ** to be animation later **
            playerTexture = a_texture;

            // Set starting position
            Position = a_position;

            // original width and height of texture
            width = playerTexture.Width;
            height = playerTexture.Height;

            // Set health

            // set collision area calculation variables
            thirdOfWidth = Width / 3f;
            halfOfWidth = Width / 2f;
            quarterOfHeight = Height / 4f;
            thirdOfHeight = Height / 3f;
            halfOfHeight = Height / 2f;

            // set smaller collision areas
            CollisionTop = new BoundingRect(this.Position.X + thirdOfWidth, this.Position.Y - 5f, thirdOfWidth, quarterOfHeight + 10f);
            CollisionBottom = new BoundingRect(this.Position.X + thirdOfWidth, this.Position.Y + quarterOfHeight * 3f, thirdOfWidth, quarterOfHeight + 5f);
            CollisionLeft = new BoundingRect(this.Position.X, this.Position.Y + quarterOfHeight, halfOfWidth, halfOfHeight);
            CollisionRight = new BoundingRect(this.Position.X + halfOfWidth, this.Position.Y + quarterOfHeight, halfOfWidth, halfOfHeight);

            // set broad collision area
            BoundingBox = new BoundingRect(this.Position.X - 10f, CollisionTop.Position.Y, this.Width + 20f, this.Height + 10f);

            // Set player health
            //health = 100;

            fuel = 100;

            fuelOutline = new Rectangle(8, 64, 201, 20);
            fuelFill = new Rectangle(9, 64, fuelFill.X + (fuel * 25), 19);

            // weapons
            sword = a_sword;
            isUsingSword = false;


            // sound effects
           // jetFart = game.Content.Load<SoundEffect>("Sound\\Fart");
           //squeak = game.Content.Load<SoundEffect>("Sound\\ShortSqueak");

            //Creating effect Instance
            //jetFartEffect = jetFart.CreateInstance();
            //jetFartEffect.Volume = 0.01f;
            //jetFartEffect.IsLooped = false;
            ////Creating an instance of squeak
            //squeakEffect = squeak.CreateInstance();
            //squeakEffect.Volume = 0.1f;
            //squeakEffect.IsLooped = false;

        }