Jump to content

Dot to Dot


Teena
 Share

Recommended Posts

 

I have an array of points like this, for an example:-

 

(x,y) pair

points=[30,50,100,20,50,90,120,80,160,20,10]

 

Its is a dot to dot kids game.Means by connecting these points you are drawing a picture.I want to show this picture at the center of game area,keeping in mind all dimensions, android/iphone devices.

 

Now how will i draw points so that image will always look centered for all devices out there?And how the points spread accordingly?

 

Example file attached!

Thanks!

post-8444-0-77809000-1413264593.jpg

Link to comment
Share on other sites

Define all points between 0 and 1.

 

Then multiply the points with the desired width/height.

 

 

e.g.

 

points=[0.2,0.5,0.8,1]

width=200

height=300

 

 

0.2 * 200, 0.5 * 300, 0.8 * 200, 1 * 300 etc

 

That way you can pass any width/height and draw a perfect vector graphic.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...