有一个运行时错误一直告诉我该名称尚未找到。看看这个错误:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.RuntimeException: Name 'lame' was not found.
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:111)
Caused by: java.lang.RuntimeException: Name 'lame' was not found.
at aurelienribon.bodyeditor.BodyEditorLoader.attachFixture(BodyEditorLoader.java:79)
at com.bodapps.shootme.physics.controller.BodyPhysicsSettings.setGoalPostBody(BodyPhysicsSettings.java:32)
at com.bodapps.shootme.view.GameScreen.show(GameScreen.java:273)
at com.badlogic.gdx.Game.setScreen(Game.java:59)
at com.bodapps.shootme.Start.create(Start.java:11)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:125)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:108)
此错误来自此代码。看看下面的代码评论。
goalPost1 = wc.getWorld().createBody(def1);
goalPost1.setActive(true);
goalPost1.setGravityScale(0);
goalPostLoader1.attachFixture(goalPost1, "lame", fixtures1, 5); // --> Under the same JSON filenamename and added and updated this name "lame." However, this is where it stops here.
goalPost2 = wc.getWorld().createBody(def2);
goalPost2.setActive(true);
goalPost2.setGravityScale(0);
goalPostLoader2.attachFixture(goalPost2, "soccer ball", fixtures2, 5); // --> This name, also in the same JSON filename. Even it has a space, it should be worked too.
JSON 文件名“ball Physics.json”,这是我从物理体编辑器引擎中获取的。
这是 JSON 文件中的代码。
{
"rigidBodies":
[
{
"name":"soccer ball",
"imagePath":"../images/soccer ball.png",
"origin":{"x":0,"y":0},"polygons":[],
"circles":[{"cx":0.5,"cy":0.5,"r":0.4756574332714081}],
"shapes":[{"type":"CIRCLE","vertices":[{"x":0.5,"y":0.5},{"x":0.5250000357627869,"y":0.02500000037252903}]}]
},
{
"name":"lame",
"imagePath":null,
"origin":{"x":0,"y":0},
"polygons":[[{"x":0.625,"y":0.05000000074505806},{"x":0.625,"y":0.949999988079071},{"x":0.3499999940395355,"y":0.949999988079071},{"x":0.3499999940395355,"y":0.05000000074505806}]],
"circles":[],
"shapes":[{"type":"POLYGON","vertices":[{"x":0.3499999940395355,"y":0.05000000074505806},{"x":0.3499999940395355,"y":0.949999988079071},{"x":0.625,"y":0.949999988079071},{"x":0.625,"y":0.05000000074505806}]}]
}
],
"dynamicObjects":[]
}
在保存为 JSON 文件的物理体编辑器编辑后,我注册了名称“ lame ”。不幸的是,即使我是正确的,编程软件也会欺骗我。请帮我尽快修复它。
更新问题!(截至 2013 年 4 月 11 日)
我想知道桌面启动项目文件夹中的资产是否与 Android 启动项目文件夹匹配或与 Android 启动项目文件夹具有相同的目录?如果是这种情况,在项目文件夹(Android starter)的 assets 文件夹中添加的更新文件是否会在 Desktop starter 项目文件夹中自动更新?