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

all i've a little trouble understanding some concepts while making game please give your suggestions on my questions.

I have a animated sprite image this i want to move this image according to given path. I can get path from

    Path path = new Path(); 
    Point s = new Point(150, 5); 
    Point cp1 = new Point(140, 125); 
    Point cp2 = new Point(145, 150); 
    Point e = new Point(200, 250); 
    path.moveTo(s.x, s.y); 
    path.cubicTo(cp1.x, cp1.y, cp2.x, cp2.y, e.x, e.y); 

    canvas.drawPath(path, paint); 

these points are hard coded and give different results on different screen.

Q1. How can i make path which is similar in all screen size?

Q2. How can i move my animated sprite image according to given path with the image has it's head according to path?

share|improve this question

Q1: You could make your points realtive to the actual screenresolution. e.g:

int referenceDisplayWidth = 1024
int referenceDisplayWidthHeight = 768
double xFactor = referenceDisplayWidth/(float)framework.getDisplayWidth()
double yFactor = referenceDisplayHeight/(float)framework.getDisplayHeight()

Now, multiply all your x-Coordinates with xFactor and y-Coordinates with yFactor. Depending on your used framework, there may be more convinient solutions, like drawing to a solution independent canvas or scaling the whole canvas before drawing it to the screen.

Q2: I guess you want to orientate your image to the normal vector of the curve at each given point. Check your used frameworks documentation.

These are more implementation questions than concept questions, in my opinion. Therefore, your used language and framework may help to receive a higher quality answer.

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.