Skip to main content
Tweeted twitter.com/#!/StackGameDev/status/213217799357739008
deleted 22 characters in body
Source Link
Jesse Dorsey
  • 2.9k
  • 4
  • 34
  • 59

Screen How would I translate screen coordinates to Isometric coordinates?

I have a function isoToScreen(x, y) that converts Isometric coordinates to Screen coordinates.

var tileW = 16;
var tileH = 16;

var isoToScreen = function(x, y) {
    var posX = (x - y) * tileW;
    var posY = (x + y) * tileH / 2;

    return [posX, posY];
};

But how would I make a function that converts screen coordinates back to Isometric coordinates?

var pos = screenToIso(16, 8); 
pos[0] = 1; // Iso X
pos[1] = 0; // Iso Y

Thanks in advance.

Screen coordinates to Isometric coordinates

I have a function isoToScreen(x, y) that converts Isometric coordinates to Screen coordinates.

var tileW = 16;
var tileH = 16;

var isoToScreen = function(x, y) {
    var posX = (x - y) * tileW;
    var posY = (x + y) * tileH / 2;

    return [posX, posY];
};

But how would I make a function that converts screen coordinates back to Isometric coordinates?

var pos = screenToIso(16, 8); 
pos[0] = 1; // Iso X
pos[1] = 0; // Iso Y

Thanks in advance.

How would I translate screen coordinates to Isometric coordinates?

I have a function isoToScreen(x, y) that converts Isometric coordinates to Screen coordinates.

var tileW = 16;
var tileH = 16;

var isoToScreen = function(x, y) {
    var posX = (x - y) * tileW;
    var posY = (x + y) * tileH / 2;

    return [posX, posY];
};

But how would I make a function that converts screen coordinates back to Isometric coordinates?

var pos = screenToIso(16, 8); 
pos[0] = 1; // Iso X
pos[1] = 0; // Iso Y
Corrected spelling and copied pastebin code into question itself
Source Link

Screen cordinatescoordinates to Isometric cordinatescoordinates

I am have a function "isoToScreen(x, y);" who convert Isometric cordinates to Screen cordinates.

Something like -> var pos = isoToScreen(1x, 0y); pos[0] = 16 // Screen X, pos[1] = 8 // Screen Y

function is here: http://pastebin.com/bT9XY0Su (Sorry I am don't understand how that converts Isometric coordinates to post here code with multiple lines)Screen coordinates.

var tileW = 16;
var tileH = 16;

var isoToScreen = function(x, y) {
    var posX = (x - y) * tileW;
    var posY = (x + y) * tileH / 2;

    return [posX, posY];
};

But how create var pos = screenToIso(16, 8); pos[0] = 1; // Iso X, pos[1] = 0 // Iso Y

How to createwould I make a function who convert Screen Cordinatesthat converts screen coordinates back to Isometric Cordinatescoordinates?

var pos = screenToIso(16, 8); 
pos[0] = 1; // Iso X
pos[1] = 0; // Iso Y

Sorry for my bad English language. Thanks in advance.

Screen cordinates to Isometric cordinates

I am have function "isoToScreen(x, y);" who convert Isometric cordinates to Screen cordinates.

Something like -> var pos = isoToScreen(1, 0); pos[0] = 16 // Screen X, pos[1] = 8 // Screen Y

function is here: http://pastebin.com/bT9XY0Su (Sorry I am don't understand how to post here code with multiple lines)

But how create var pos = screenToIso(16, 8); pos[0] = 1; // Iso X, pos[1] = 0 // Iso Y

How to create function who convert Screen Cordinates to Isometric Cordinates?

Sorry for my bad English language. Thanks.

Screen coordinates to Isometric coordinates

I have a function isoToScreen(x, y) that converts Isometric coordinates to Screen coordinates.

var tileW = 16;
var tileH = 16;

var isoToScreen = function(x, y) {
    var posX = (x - y) * tileW;
    var posY = (x + y) * tileH / 2;

    return [posX, posY];
};

But how would I make a function that converts screen coordinates back to Isometric coordinates?

var pos = screenToIso(16, 8); 
pos[0] = 1; // Iso X
pos[1] = 0; // Iso Y

Thanks in advance.

Source Link
Veyha
  • 85
  • 1
  • 5

Screen cordinates to Isometric cordinates

I am have function "isoToScreen(x, y);" who convert Isometric cordinates to Screen cordinates.

Something like -> var pos = isoToScreen(1, 0); pos[0] = 16 // Screen X, pos[1] = 8 // Screen Y

function is here: http://pastebin.com/bT9XY0Su (Sorry I am don't understand how to post here code with multiple lines)

But how create var pos = screenToIso(16, 8); pos[0] = 1; // Iso X, pos[1] = 0 // Iso Y

How to create function who convert Screen Cordinates to Isometric Cordinates?

Sorry for my bad English language. Thanks.