Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7799371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:17:14+00:00 2026-06-02T00:17:14+00:00

I decided to make a isometric game using c++ and cocos2d-x. Each isometric tile

  • 0

I decided to make a isometric game using c++ and cocos2d-x.
Each isometric tile has an X and an Y coordinate, incresing 1 per tile moved. This is how I am converting tile to screen coordinates.

cocos2d::CCPoint WorldPos::convertToScreen(){
    cocos2d::CCPoint posScreen;; 
    posScreen.x=(this->x)*(TILE_WIDTH/2) + (this->y)*-TILE_HEIGHT;
    posScreen.y=(this->x)*(TILE_HEIGHT/2) + (this->y)*(TILE_HEIGHT/2);

    return posScreen;
}

The tiles are all 40px wide and 20px tall.

now I need a function to convert these world coordinates (the isometric coordinates) back to screen coordinates. something like

WorldPos* WorldPos::convertToWorld(cocos2d::CCPoint &point)

I can’t seem to figure this one out, am I doing it all wrong and should I do positioning is a diffirent way or is there some kind of calculation that I can’t figure out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:17:16+00:00Added an answer on June 2, 2026 at 12:17 am

    Try:

    WorldPos WorldPos::convertToWorld(cocos2d::CCPoint &point) {
      int x = (point.x + 2*point.y)/40;
      int y = (2*point.y - point.x)/40;
      return WorldPos(x, y);
    }
    

    Logic:

    Px = 20*Wx - 20*Wy
    Py = 10*Wx + 10*Wy, thus
    
    Px + 2*Py = 40*Wx -> Wx = (Px + 2*Py) / 40
    Px - 2*Py = -40*Wy -> Wy = (2*Py - Px) / 40
    

    where Px, Py, Wx, Wy are CCpoint::x, CCPoint::y, WorldPos::x, WorldPos.y, respectively

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok this time I decided to make a list using the STL. I need
I decided to make a 2d game in Java (using the slick2d library and
I decided to make a system for a client using Castle ActiveRecord , everything
My marketing department, bless them, has decided to make a sweepstakes where people enter
Few weeks ago I decided to make an app, this app contained just video
Me and my fellow classmates decided to make a game over the summer. At
For my first project in flash I decided to make a little football game.
Recently I published my new app, and this morning I decided to make a
Just getting into python, and so I decided to make a hangman game. Works
I'm learning C and I decided to make a text game as my learning

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.