Ejemplo n.º 1
0
        /* MOVEMENT */
        public void MoveLeft(Terrarium terr)
        {
            FrameIndex++;
            float oldX = X;
            float oldY = Y;

            FacingDirection = Direction.LEFT;

            X = X - MovementSpeed;
            Rectangle charRect = new Rectangle((int)X, (int)Y, (int)Width, (int)Height);

            if (charRect.Intersects(terr.LeftWall.WallRect) || charRect.Intersects(terr.RightWall.WallRect) ||
                charRect.Intersects(terr.TopWall.WallRect) || charRect.Intersects(terr.BottomWall.WallRect))
            {
                X = oldX;
                Y = oldY;
            }
            foreach (ATerrain block in terr.Terrain.TGrid)
            {
                if (charRect.Intersects(block.TRect))
                {
                    X = oldX;
                    Y = oldY;
                }
            }
        }
Ejemplo n.º 2
0
 public void FaceForward(Terrarium terr)
 {
 }