예제 #1
0
        public override void Update(Movement movement, Player player)
        {
            if (movement.Area.Center.X > player.Movement.Area.Center.X)
            {
                movement.Intention.Left = true;
                movement.Intention.Right = false;
            }
            else
            {
                movement.Intention.Left = false;
                movement.Intention.Right = true;
            }

            if (movement.Area.Center.Y > player.Movement.Area.Center.Y + 20)
            {
                movement.Intention.Jumping = true;
            }
            else
            {
                movement.Intention.Jumping = false;
            }

            if (movement.Area.Center.X - player.Movement.Area.X > -40 && movement.Area.Center.X - player.Movement.Area.X < 40)
            {
                movement.Intention.Left = false;
                movement.Intention.Right = false;
                movement.Intention.Jumping = false;
            }
        }
예제 #2
0
 public LiveProjectile(Weapon weapon, Vector2 location, float force, Control control, Camera camera)
     : base(weapon, location)
 {
     Movement = new Movement(location, 24, 6);
     Movement.Gravity = 0.15f;
     Movement.Drag = 0.06f;
     Movement.PushbackFrom(new Vector2(control.currentMouse.X - camera.X, control.currentMouse.Y - camera.Y), force);
     TimeToLive = 250;
 }
예제 #3
0
 public ActiveNpc(NpcType npc, Vector2 location )
 {
     Type = npc;
     Ai = npc.DefaultAi;
     Name = Type.Name;
     Health = npc.BaseStats.Str * 10;
     Movement = new Movement(location, npc.Race.Animation.CurrentLocation.Width, npc.Race.Animation.CurrentLocation.Height);
     Invunerable = 0;
     CurrentPath = null;
 }
예제 #4
0
 public bool Damage(int amount)
 {
     if (Invunerable > 0) { return false; }
     Health -= amount;
     if (Health <= 0)
     {
         // Die
         Health = 100;
         Movement = new Movement(new Vector2(100, -100), 32, 44);
         PositionCamera = true;
         return true;
     }
     Invunerable = 10;
     return false;
 }
예제 #5
0
        public void Update(Movement movement)
        {
            if ( movement.Moved.Y < 0)
            {
                UseAnimation("jumping");
            } else if (movement.Falling)
            {
                UseAnimation("falling");
            }
            else if (movement.Moved.X > 0 || movement.Moved.X < 0)
            {
                UseAnimation("running");
            } else {
                UseAnimation("default");
            }

            if (movement.Direction != CurrentDirection)
            {
                CurrentDirection = movement.Direction;
            }

            // Same animation, moving on
            TimeUpto++;
            if (TimeUpto > CurrentAnimation.Time)
            {
                TimeUpto = 0;
                FrameUpto++;
                if (FrameUpto >= CurrentAnimation.Frames.Length)
                {
                    UseAnimation(CurrentAnimation.Name, "loop", true);
                }

            }

            CurrentLocation = movement.Area;
        }
예제 #6
0
        /// <summary>
        /// Applies intentions to movement related to moving towards dest
        /// </summary>
        /// <param name="movement"></param>
        /// <param name="dest"></param>
        private void MovementChase(Movement movement, Rectangle dest)
        {
            if (movement.Area.Center.X > dest.Center.X)
            {
                movement.Intention.Left = true;
                movement.Intention.Right = false;
            }
            else
            {
                movement.Intention.Left = false;
                movement.Intention.Right = true;
            }

            if (movement.Area.Center.Y >= dest.Bottom)
                movement.Intention.Jumping = true;
            else
                movement.Intention.Jumping = false;
        }
예제 #7
0
 private void MovementChase(Movement movement, Point dest)
 {
     MovementChase(movement, new Rectangle(dest.X * 24, dest.Y * 24, 24,24));
 }
예제 #8
0
        public void Initialize(Texture2D playerTexture, Texture2D barsTexture, Package package, Vector2 position)
        {
            BarsTexture = barsTexture;
            PlayerTexture = playerTexture;

            Health = 100;
            Mana = 100;
            Speed = 4f;
            Name = "Firebolt";
            Inventory = new Inventory();

            // Animation
            Animation = new Animations(package.LocalString("C:\\blueprint\\player.xml", false));
            Movement = new Movement(position, 32, 44);
        }
예제 #9
0
 public abstract void Update(Movement movement, Player player);
예제 #10
0
 public override void Update(Movement movement, Player player)
 {
 }
예제 #11
0
 public DroppedItem(Vector2 location, Item item)
 {
     Item = item;
     Movement = new Movement(location, 16, 16, .15f);
     SettleCounter = 30;
 }