Example #1
0
        public Player(Image image, GameWorld gameWorld)
        {
            double speed = 0.000001;
            this.MotionBehavior = new NormalMotionBehavior(this, gameWorld);
            MotionBehavior.CanMoveThroughWall = false;
            Location = new DecimalPoint(300, 150);
            Image = image;
            Angle = 0;
            ActualSpeed = 0;
            Acceleration = 0.3;
            TargetSpeed = 0;
            Inertia = new DecimalPoint(0.5, 0.5);
            DrawBehavior = new TopDownRotationDrawBehavior(this);
            //((GrowingImageDrawBehavior)DrawBehavior).SpeedX = 10;
            //((GrowingImageDrawBehavior)DrawBehavior).SpeedY = 10;
            //((GrowingImageDrawBehavior) DrawBehavior).SizeChanged += (Size) =>
            //{
            //    if (Size.Width > 400)
            //    {
            //        ((GrowingImageDrawBehavior)DrawBehavior).SpeedX = -2;
            //        ((GrowingImageDrawBehavior)DrawBehavior).SpeedY = -2;
            //    }

            //    if (((GrowingImageDrawBehavior) DrawBehavior).SpeedY < 0)
            //    {
            //            ((GrowingImageDrawBehavior)DrawBehavior).SpeedX = 0 - (int)speed;
            //            ((GrowingImageDrawBehavior)DrawBehavior).SpeedY = 0 - (int)speed;
            //            speed += speed;
            //    }

            //};

            Paralax = Paralax.Middleground;
            IsPhysicalObject = true;
        }
Example #2
0
        protected PowerUp(DecimalPoint location, GameWorld gameWorld)
        {
            Location = location;
            GameWorld = gameWorld;
            GameWorld.Collision += gameWorld_Collision;

            Inertia = new DecimalPoint(0, 0);
            MotionBehavior = new StationaryMotionBehavior(this, gameWorld);
            Paralax = Paralax.Middleground;
            DrawBehavior = new TopDownRotationDrawBehavior(this);

            IsPhysicalObject = false;
        }
Example #3
0
 public Enemy(Image image, GameWorld gameWorld)
 {
     Image = image;
     this.MotionBehavior = new NormalMotionBehavior(this, gameWorld);
     Location = new DecimalPoint(300, 150);
     Image = image;
     Angle = 0;
     ActualSpeed = 0;
     Acceleration = 0.3;
     TargetSpeed = 0;
     Inertia = new DecimalPoint(0.5, 0.5);
     DrawBehavior = new TopDownRotationDrawBehavior(this);
     Paralax = Paralax.Middleground;
     IsPhysicalObject = true;
 }
Example #4
0
        private void Init()
        {
            Acceleration = 5;
            Angle = Source.Target != null ? (int)GameWorld.CalcAngle(Source.Location.ToPoint(), Source.Target.Location.ToPoint()) : Source.Angle;
            Cost = 20;
            Damage = 200;
            DamageBehavior = new NormalDamageBehavior(Source, Source.Targets, (int)Damage);
            DrawBehavior = new TopDownRotationDrawBehavior(this);
            Inertia = new DecimalPoint(5, 5);
            ActualSpeed = Source.ActualSpeed;
            Location = new DecimalPoint(Source.Location.X, Source.Location.Y);
            MotionBehavior = new NormalMotionBehavior(this, GameWorld);
            Paralax = Paralax.Middleground;
            TargetSpeed = 20;
            IsPhysicalObject = false;
            MotionBehavior.CanMoveThroughObjects = true;
            SpellHandler = Source.SpellHandler;
            SpellHandler.Spells.Add(this);
            AttackBehaviors = new List<IAttackBehavior>();

            GameWorld.Collision += GameWorld_Collision;
            GameWorld.Split += GameWorld_Split;
        }
Example #5
0
 private void Init()
 {
     gw.Collision += gw_Collision;
     Acceleration = 2;
     Inertia = new DecimalPoint(5, 5);
     TargetSpeed = 30;
     MotionBehavior = new NormalMotionBehavior(this, gw);
     MotionBehavior.WallCollision += MotionBehavior_WallCollision;
     gw.GameObjects.Add(this);
     DrawBehavior = new TopDownRotationDrawBehavior(this);
     Paralax = Paralax.Foreground;
     IsPhysicalObject = false;
 }
        private void Init()
        {
            Energy = new Mana(300);
            Health = new Health(1000);

            DrawBehavior = new TopDownRotationDrawBehavior(this);

            Level = 1;
            Experience = new NormalExperience();

            Inertia = new DecimalPoint(0.5, 0.5);
            Acceleration = 5;
            IsPhysicalObject = true;

            Paralax = Paralax.Middleground;

            SpellHandler = new SpellHandler(GameWorld, this);
            AttackMap = new Dictionary<ActionSlot, Func<Spell>>();

            ExperienceWhenKilled = 300;

            Loot = new Loot();
            Loot.Items.Add(new HealthPowerUp(Location, GameWorld));

            Experience.LevelUp += Experience_LevelUp;
            Killed += Character_Killed;
        }