예제 #1
0
        public override void TryDestroy(GameForm form)
        {
            var player = (Player)form.GameSpace.Map["Player"];

            if (player.Column == form.GameSpace.Map[Name, true].Column && player.Row == form.GameSpace.Map[Name, true].Row)
            {
                form.GameSpace.Map[player.Column, player.Row].Gold = null;
                form.Scores++;
            }
        }
예제 #2
0
 public override Image GetTexture(GameForm form)
 {
     if (Type == WallType.Brick)
     {
         return(TextureGetter("brick"));
     }
     else
     {
         return(base.GetTexture(form));
     }
 }
예제 #3
0
 public override Image GetTexture(GameForm form)
 {
     if (Type == GoldType.Usual)
     {
         return(TextureGetter("usual"));
     }
     else
     {
         return(TextureGetter("secret"));
     }
 }
예제 #4
0
 public override Image GetTexture(GameForm form)
 {
     if (Type == DoorwayType.Enter)
     {
         return(TextureGetter("enter", 0.01));
     }
     else
     {
         return(TextureGetter("exit", 0.01));
     }
 }
예제 #5
0
 public override Image GetTexture(GameForm form)
 {
     if (Type == BoxType.Wooden)
     {
         return(TextureGetter("wooden"));
     }
     else if (Type == BoxType.Carton)
     {
         return(TextureGetter("carton"));
     }
     else
     {
         return(TextureGetter("ice"));
     }
 }
예제 #6
0
 public override Image GetTexture(GameForm form)
 {
     if (Type == LadderType.Metal)
     {
         return(TextureGetter("metal"));
     }
     else if (Type == LadderType.Wooden)
     {
         return(TextureGetter("wooden"));
     }
     else
     {
         return(TextureGetter("ice"));
     }
 }
예제 #7
0
        public void Move(GameForm form)
        {
            if (Speed.X > 0)
            {
                if (form.GameSpace.Map[Column, Row].Right != null)
                {
                    if (form.GameSpace.Map[Column, Row].Right.IsPermeable || Spacing.X > 0)
                    {
                        Position += new Vector(Speed.X, 0);
                    }
                }
            }

            if (Speed.X < 0)
            {
                if (form.GameSpace.Map[Column, Row].Left != null)
                {
                    if (form.GameSpace.Map[Column, Row].Left.IsPermeable || Spacing.X < 0)
                    {
                        Position += new Vector(Speed.X, 0);
                    }
                }
            }

            if (Speed.Y > 0)
            {
                if (form.GameSpace.Map[Column, Row].Bottom != null)
                {
                    if (form.GameSpace.Map[Column, Row].Bottom.IsPermeable || Spacing.Y > 0)
                    {
                        Position += new Vector(0, Speed.Y);
                    }
                }
            }

            if (Speed.Y < 0)
            {
                if (form.GameSpace.Map[Column, Row].Top != null)
                {
                    if (form.GameSpace.Map[Column, Row].Top.IsPermeable || Spacing.Y < 0)
                    {
                        Position += new Vector(0, Speed.Y);
                    }
                }
            }
        }
예제 #8
0
        public override void TryDestroy(GameForm form)
        {
            var player = (Player)form.GameSpace.Map["Player"];

            if (player.Column == form.GameSpace.Map[Name, true].Column + 1 && player.Row == form.GameSpace.Map[Name, true].Row)
            {
                if (player.direction == Player.Direction.Left && player.actions.Contains(Player.Action.Shot))
                {
                    form.GameSpace.Map[player.Column - 1, player.Row].Block = null;
                    return;
                }
            }

            if (player.Column == form.GameSpace.Map[Name, true].Column - 1 && player.Row == form.GameSpace.Map[Name, true].Row)
            {
                if (player.direction == Player.Direction.Right && player.actions.Contains(Player.Action.Shot))
                {
                    form.GameSpace.Map[player.Column + 1, player.Row].Block = null;
                    return;
                }
            }
        }
예제 #9
0
 public override void Update(GameForm form)
 {
     if (!IsDead)
     {
         if (direction == Direction.Left)
         {
             if (form.GameSpace.Map[Column, Row].Left != null)
             {
                 if ((!form.GameSpace.Map[Column, Row].Left.IsPermeable) ||
                     ((form.GameSpace.Map[Column, Row].Left.Bottom != null) &&
                      (form.GameSpace.Map[Column, Row].Left.Bottom.IsPermeable)))
                 {
                     if (Spacing.Length < 5)
                     {
                         direction = Direction.Right;
                     }
                 }
             }
             Position += new Vector(-1, 0);
         }
         else
         {
             if (form.GameSpace.Map[Column, Row].Right != null)
             {
                 if ((!form.GameSpace.Map[Column, Row].Right.IsPermeable) ||
                     ((form.GameSpace.Map[Column, Row].Right.Bottom != null) &&
                      (form.GameSpace.Map[Column, Row].Right.Bottom.IsPermeable)))
                 {
                     if (Spacing.Length < 5)
                     {
                         direction = Direction.Left;
                     }
                 }
             }
             Position += new Vector(1, 0);
         }
     }
     base.Update(form);
 }
예제 #10
0
        static void Main(string[] args)
        {
            var form = new GameForm();

            Application.Run(form);
        }
예제 #11
0
 public virtual void Update(GameForm form)
 {
     form.Invalidate();
 }
예제 #12
0
 public virtual void TryDestroy(GameForm form)
 {
 }
예제 #13
0
 public virtual Image GetTexture(GameForm form)
 {
     return(Image.FromFile("images/standard.png"));
 }
예제 #14
0
        public override void Update(GameForm form)
        {
            if (Speed.Length > 0)
            {
                Speed -= Speed.Normalize() * 1.5;
            }

            if (Speed.Length > 8)
            {
                Speed = Speed.Normalize() * 8;
            }
            if (form.GameSpace.Map[Column, Row].Block is Ladder)
            {
                if (Spacing.Length < 10)
                {
                    Speed = Vector.Zero;
                }
                if (actions.Contains(Action.Climb))
                {
                    if (direction == Direction.Up)
                    {
                        if (Speed.Y > -4)
                        {
                            Speed += new Vector(0, -4);
                        }
                    }
                    if (direction == Direction.Down)
                    {
                        if (Speed.Y < 4)
                        {
                            Speed += new Vector(0, 4);
                        }
                    }
                    if (direction == Direction.Left)
                    {
                        if (Speed.X > -4)
                        {
                            Speed += new Vector(-4, 0);
                        }
                    }
                    if (direction == Direction.Right)
                    {
                        if (Speed.X < 4)
                        {
                            Speed += new Vector(4, 0);
                        }
                    }
                }
            }
            else
            {
                Speed += new Vector(0, 3);
                if (actions.Contains(Action.Run))
                {
                    if (direction == Direction.Left)
                    {
                        if (Speed.X > -4)
                        {
                            Speed += new Vector(-4, 0);
                        }
                    }
                    if (direction == Direction.Right)
                    {
                        if (Speed.X < 4)
                        {
                            Speed += new Vector(4, 0);
                        }
                    }
                }
                if (actions.Contains(Action.Jump))
                {
                    if (form.GameSpace.Map[Column, Row].Bottom != null)
                    {
                        if (!form.GameSpace.Map[Column, Row].Bottom.IsPermeable && Spacing.Y < 3)
                        {
                            Jump();
                        }
                    }
                }
            }
            Move(form);
            if (Row == 11)
            {
                Destroy();
            }
            base.Update(form);
        }