0

我正在开发原型游戏,MOBA 测试:D

我的运动有问题。我想拥有它,就像英雄联盟一样,一个点击步行系统。同样,角色面对它走过的地方。

这将是一个 2D 自上而下的游戏。

我一直在想,我有一个播放器,还有一个 dot 类。

在点类中,我可以放置一个变量,例如:isVisible。在draw方法中:

public void Draw(SpriteBatch spriteBatch) {
    if (isVisible) {
        spriteBatch.Draw(//.....)
    }
}

在播放器中,类似:

if (dot.isVisible) {
    //moving towards point code
}

那行得通吗?

提前致谢!

4

1 回答 1

0

是的,应该没问题。似乎是处理它的好方法,但您也可以只存储一个 Point(或我认为是 Vector3)对象,并在没有可访问点时将其设置为 null。

public void Draw(SpriteBatch spriteBatch) {
    if (point != null) {
        spriteBatch.Draw(//.....)
    }
}

if (point != null) {
    //moving towards point code
}

这也可能对您的//moving toword point code问题有所帮助https://gamedev.stackexchange.com/questions/53879/xna-moving-towards-3d-point-rts-style虽然当我最后一次寻找寻路时,我能找到的最好的是白皮书.

于 2013-08-14T15:44:14.423 回答