Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 2D grid (x,y coordinates) where each cell corresponds to each pixel of the interface that I am working with and I have a point A(x1,y1). Now I need to travel around in the grid, and I wont just move this single point, but would like to move a bunch of points together. Now what do you think is the best figure that I shall move, i.e. a circle with a predefined radius, or a square with a fixed side.

Also, once I decide upon the figure, I need to know, what all points are there in the figure, given a specific central point, and work with those points too.

I was thinking that a square would be a better idea, since I'll just have to check the if the difference of the coordinates of the point to be checked from the central point is less than side/2.

But I've heard that calculations with circle are not bad either.

Kindly suggest,

share|improve this question
So if I understand your question correctly, you would like to "move" a geometrical shape on the screen? – Marton Mar 22 '13 at 12:48
up vote 2 down vote accepted
  1. Write a method that draws the "bunch of points" around the central point.

    public void DrawMyPoints(Point center)
         float radius = 10.0;
         MyPreferredGraphicsLib.DrawCircle(center, radius);
         //Draw a circle or a square, for example.
         //Most graphics libraries have dedicated methods for basic geometrical shapes.
  2. Every time you move the center point, clear the screen and redraw all the points:

    public void MoveMyPoints(Point newCenter)
         MyPreferredGraphicsLib.ClearScreen(); //Usually automatic in anything post-Pascal.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.