Inheritance: AnimatedSprite
Example #1
0
 public void TargetPositionTest()
 {
     PrincessZelda target = new PrincessZelda(); // TODO: Initialize to an appropriate value
     Vector2 expected = new Vector2(300, 400);
     Vector2 actual;
     target.TargetPosition = expected;
     actual = target.TargetPosition;
     Assert.AreEqual(expected, actual);
 }
Example #2
0
 public void statusTest()
 {
     PrincessZelda target = new PrincessZelda(); // TODO: Initialize to an appropriate value
     int expected = 1; // TODO: Initialize to an appropriate value
     int actual;
     target.status = expected;
     actual = target.status;
     Assert.AreEqual(expected, actual);
 }
Example #3
0
 public void PrincessZeldaConstructorTest()
 {
     PrincessZelda target = new PrincessZelda();
     Assert.IsNotNull(target);
 }
Example #4
0
 public void ZeldaUpdateTest()
 {
     PrincessZelda target = new PrincessZelda(); // TODO: Initialize to an appropriate value
     GameTime theGameTime = null; // TODO: Initialize to an appropriate value
     target.ZeldaUpdate(theGameTime);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Example #5
0
        //Obtain how far collide with the object and move back to original position
        //For Zelda sprite
        public void SpriteCollision(ref PrincessZelda name)
        {
            //Temporary Value for Object position
            Vector2 currentPos;

            //Difference between each objects edges
            Vector2 Diff = new Vector2(0, 0);

            //Obtain difference from Actionhandler
            Diff = CollisionCheck(name.SpriteID);

            //For X axis difference
            if (Math.Abs(Diff.X) > 0)
            {
                currentPos = name.pos;
                currentPos.X -= Diff.X;
                name.pos = currentPos;
            }
            //For Y axis difference
            if (Math.Abs(Diff.Y) > 0)
            {
                currentPos = name.pos;
                currentPos.Y -= Diff.Y;
                name.pos = currentPos;
            }
        }
Example #6
0
        /// <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

            //Game starts with the menu
            state = gamestate.menu;

            //Game play starts with start map
            MapState = gamemap.start;
            previousMapState = MapState;

            //Player that can move around
            player = new Character();

            //ID number 0 indicate character that is only one exist.
            player.SpriteID = 0;

            //ID number 2xx indicate Enemy
            Enemy1 = new EnemyCharacter();
            Enemy1.SpriteID = 201;
            Dragon1 = new Dragon();
            Dragon1.SpriteID = 202;
            Enemy2 = new EnemyCharacter();
            Enemy2.SpriteID = 203;
            Enemy3 = new EnemyCharacter();
            Enemy3.SpriteID = 204;
            Enemy4 = new EnemyCharacter();
            Enemy4.SpriteID = 205;

            //ID number 1 indicate PrincessZelda
            Zelda = new PrincessZelda();
            Zelda.SpriteID = 1;

            //Backgrounds
            menu = new Sprite();
            help = new Sprite();
            BG0 = new Sprite();
            Blood = new Sprite();
            Thanks = new Sprite();
            Story1 = new Sprite();
            Story2 = new Sprite();

            //ID 9xx indicate non object sprite
            menu.SpriteID = 901;

            //ID 1xx indicate stationary object
            tree1 = new Sprite(101);
            tree2 = new Sprite(102);
            tree3 = new Sprite(103);
            tree4 = new Sprite(104);
            tree5 = new Sprite(105);

            //ID 5xx indicate Key acition abject that cause some action
            Arrow = new Sprite(501);

            //Action Handling including Collision Detection and EnemySight
            Action = new Collision();

            base.Initialize();
        }