Esempio n. 1
0
        public void Update(NinjaGaiDemake_Game game, float deltaTime)
        {
            // move with player
            position.X += speed * (int)dir;
            // update bounding box
            boundingBox.UpdatePosition(new Vector2(position.X, position.Y));
            if (behaviour == Behaviour.PATH)
            {
                if (position.X < min.X)
                {
                    dir = Direction.RIGHT;
                }
                else if (position.X > max.X)
                {
                    dir = Direction.LEFT;
                }
            }

            // Sword Collision
            if (game.player.isUsingSword)
            {
                if (this.boundingBox.Intersects(game.player.sword.BoundingBox))
                {
                    this.isAlive = false;
                }
            }
        }
Esempio n. 2
0
        public void Update(NinjaGaiDemake_Game game, float deltaTime)
        {
            // move with player
            position.X += speed * (int)dir;
            // update bounding box
            boundingBox.UpdatePosition(new Vector2(position.X, position.Y));
            if (behaviour == Behaviour.PATH)
            {
                if (position.X < min.X)
                    dir = Direction.RIGHT;
                else if (position.X > max.X)
                    dir = Direction.LEFT;
            }

            // Sword Collision
            if (game.player.isUsingSword)
                if (this.boundingBox.Intersects(game.player.sword.BoundingBox))
                {
                    this.isAlive = false;
                }
        }
Esempio n. 3
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;
        }
Esempio n. 4
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;

        }
Esempio n. 5
0
 static void Main()
 {
     using (var game = new NinjaGaiDemake_Game())
         game.Run();
 }