public void TimerMoving() { if (this.view.GetKeyPress().IsDownUp == true) { InteractionObjects helperWithInteration = new InteractionObjects(view.Location, view.Width, view.Height); Point pointSubject = new Point(model.GetPlayer().LocateX + view.Location.X, model.GetPlayer().LocateY + view.Location.Y - 5); int widthSubject = model.GetPlayer().GetImagePlayer().Width; int heightSubject = model.GetPlayer().GetImagePlayer().Height; if (helperWithInteration.IsLocated(pointSubject, widthSubject, heightSubject) == true) { this.model.GetPlayer().LocateY -= 5; } } if (this.view.GetKeyPress().IsDownRight == true) { InteractionObjects helperWithInteration = new InteractionObjects(view.Location, view.Width, view.Height); Point pointSubject = new Point(model.GetPlayer().LocateX + view.Location.X + 5, model.GetPlayer().LocateY + view.Location.Y); int widthSubject = model.GetPlayer().GetImagePlayer().Width; int heightSubject = model.GetPlayer().GetImagePlayer().Height; if (helperWithInteration.IsLocated(pointSubject, widthSubject, heightSubject) == true) { this.model.GetPlayer().LocateX += 5; } } if (this.view.GetKeyPress().IsDownDown == true) { InteractionObjects helperWithInteration = new InteractionObjects(view.Location, view.Width, view.Height); Point pointSubject = new Point(model.GetPlayer().LocateX + view.Location.X, model.GetPlayer().LocateY + view.Location.Y + 5); int widthSubject = model.GetPlayer().GetImagePlayer().Width; int heightSubject = model.GetPlayer().GetImagePlayer().Height; if (helperWithInteration.IsLocated(pointSubject, widthSubject, heightSubject) == true) { this.model.GetPlayer().LocateY += 5; } } if (this.view.GetKeyPress().IsDownLeft == true) { InteractionObjects helperWithInteration = new InteractionObjects(view.Location, view.Width, view.Height); Point pointSubject = new Point(model.GetPlayer().LocateX + view.Location.X - 5, model.GetPlayer().LocateY + view.Location.Y); int widthSubject = model.GetPlayer().GetImagePlayer().Width; int heightSubject = model.GetPlayer().GetImagePlayer().Height; if (helperWithInteration.IsLocated(pointSubject, widthSubject, heightSubject) == true) { this.model.GetPlayer().LocateX -= 5; } } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); InteractionObjects a = new InteractionObjects(new Point(50, 50), 50, 300); bool mm = a.IsLocated(new Point(5, 5), 300, 300); GameView view = new GameView(); GameModel model = new GameModel(); GameController controller = new GameController(view, model); Application.Run(view); }