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; } }
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; }
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; }
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; }
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; }
/// <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; }
private void MovementChase(Movement movement, Point dest) { MovementChase(movement, new Rectangle(dest.X * 24, dest.Y * 24, 24,24)); }
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); }
public abstract void Update(Movement movement, Player player);
public override void Update(Movement movement, Player player) { }
public DroppedItem(Vector2 location, Item item) { Item = item; Movement = new Movement(location, 16, 16, .15f); SettleCounter = 30; }