我正在 Java培养第一手枪手,我希望实施控制,使汽车的移动能够轮到参与者。 然而,在 Java,我只能通过使用<代码>MouseListener的活动来获得模拟坐标,因此,一旦 mo曲者离开监测边缘,我就无法改变参与者的意见。
任何关于如何做到这一点的推论/建议? 感谢。
我正在 Java培养第一手枪手,我希望实施控制,使汽车的移动能够轮到参与者。 然而,在 Java,我只能通过使用<代码>MouseListener的活动来获得模拟坐标,因此,一旦 mo曲者离开监测边缘,我就无法改变参与者的意见。
任何关于如何做到这一点的推论/建议? 感谢。
在某些游戏中,每次运动活动上, cur子都被转回到屏幕的中间,而这种观点也随着活动的规模和方向而改变。 在把 cur子放在中心之前,你可以把 cur子的位置计算到屏幕的中心。 将 cur子带回屏幕中心,请你使用。 班级。
由于你重建了第一手枪手,你可能想躲藏该中心的锁 cur子,并在参与者打算瞄准的地方抽取自己的十字架。 这还将涉及跟踪曲线(should>)的运行情况。
如果你想要达到一种行为,即对 mo的起始位置(即使 mo已停止移动)的看法会继续改变,那么你就可以把以前所有的 mo变运动矢量保持一流,并相应地把这一观点推向每个框架。 然而,这很可能更多地适用于像飞行模拟器这样的东西,而不是第一手发射器。
I tried using a java.awt.Robot
as AerandiR suggests, but there were a couple of problems I ran into, and it s possible other people will run into them as well, so I will elaborate.
如果您的目标是使 cur处于一种地位(最好是屏幕中心),那么你就希望打上像<代码>/robot.mouseMove(width/2,width/2);,在您的<代码>上。 在实施后,每当烟雾转移到中心时,Robot
就会将其移回中心。
但是,当
为了确定这一点,而不是界定你的角色在多大程度上改变了现在和现在的距离,将其定义为与中心之间的距离。
类似:turnAmountX += e.getX() - width/2;
现在,如果<条码>Robot 重新定位,则总能产生零。
Recap:
void mouseMoved(MouseEvent e) {
turnAmountX += e.getX() - width/2;
turnAmountY += e.getY() - height/2;
robot.mouseMove(this.getLocationOnScreen().x + width/2,
this.getLocationOnScreen().y + height/2;
}
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...