示例#1
0
 void Brush(float topLeftX, float topLeftY, float bottomRightX, float bottomRightY)
 {
     //left
     if (this.Position.Y >= bottomRightY && this.Position.Y <= topLeftY && this.Position.X >= topLeftX && this.Position.X <= topLeftX + 5)
     {
         AnimationData.GoToFrame(1);
         yvel        = 0;
         xvel        = 0;
         this.zOrder = 0;
     }
     //right
     if (this.Position.Y >= bottomRightY && this.Position.Y <= topLeftY && this.Position.X <= bottomRightX && this.Position.X >= bottomRightX - 5)
     {
         AnimationData.GoToFrame(1);
         yvel        = 0;
         xvel        = 0;
         this.zOrder = 0;
     }
     //top
     if (this.Position.X <= bottomRightX && this.Position.X >= topLeftX && this.Position.Y <= topLeftY + 10 && this.Position.Y >= topLeftY - 5)
     {
         AnimationData.GoToFrame(2);
         yvel        = 0;
         xvel        = 0;
         this.zOrder = 0;
     }
     //bottom
     if (this.Position.Y >= bottomRightY && this.Position.Y <= bottomRightY + 5 && this.Position.X <= bottomRightX && this.Position.X >= topLeftX)
     {
         AnimationData.GoToFrame(2);
         yvel        = 0;
         xvel        = 0;
         this.zOrder = 0;
     }
 }