我查了一下你的参考游戏,明白你的意思是“2.5D”。根据我的理解,解决此问题的最佳方法是通过变换对象的x,y坐标来创建伪三维。你会有一个功能为你做转换,这里是我对一个例子的最好猜测。
// 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坐标。这就是你的示例游戏所做的。希望我的输入帮助,
里根
谢谢你,我一定会看看这些引擎作为一种形式的灵感。 – clicheName 2012-07-15 10:35:22