あなたのリファレンス ゲームをチェックして、「2.5D」の意味を理解しました。私の理解では、この問題に取り組む最善の方法は、オブジェクトの x、y 座標を変換して疑似 3 次元を作成することです。あなたに代わって変換を行う関数があるでしょう。これが私の最良の例の推測です。
// This function takes in a x- and y-coordinates of an object corner and returns the
// coordinates of the corresponding back corner of an object.
var transform = function(x,y) {
// The farther the character is from the object, the more skew there would be.
// Here "char" is your globally recognized game character. If it was not in the scope
// of the function you'd have to pass it as a parameter.
var skew = (char.x > x) ? (char.x - x) : (x - char.x);
var newx = (skew * 0.1); // obviously this would be variable depending on your liking
// If the object corner is not on the ground (y == 0) then subtract from it's value,
// otherwise add.
var newy = (y > 0) ? (y - 10) : (y + 10);
};
私の例10
では、y座標を変更する距離単位の量です。これは、サンプルゲームがそれを行うように見える方法です。私の入力がお役に立てば幸いです。
レーガン