예제 #1
0
        public bool istouchingwall(wall w)
        {
            PointF nearest  = w.pointnearestto(this);
            float  distance = (float)Math.Sqrt((nearest.X - this.location.X) * (nearest.X - this.location.X)
                                               + (nearest.Y - this.location.Y) * (nearest.Y - this.location.Y));

            return(this.radius > distance);
        }
예제 #2
0
        public void createborders()
        {
            wall wall1 = new wall(0, 0, 30, levelheight);

            walllist.Add(wall1);

            wall wall2 = new wall(0, 0, levelwidth, 30);

            walllist.Add(wall2);

            wall wall3 = new wall(0, levelheight - 30, levelwidth - 30, 30);

            walllist.Add(wall3);

            wall wall4 = new wall(levelwidth, 0, 30, levelheight - 30);

            walllist.Add(wall4);
        }
예제 #3
0
        public void addwall(int top, int left, int width, int height)
        {
            wall wall1 = new wall(top, left, width, height);

            walllist.Add(wall1);
        }
예제 #4
0
 public override void hitwall(wall w)
 {
     this.destroy();
 }
예제 #5
0
 public virtual void hitwall(wall w)
 {
     bouncefrom(w.pointnearestto(this));
 }