0

有一个运行时错误一直告诉我该名称尚未找到。看看这个错误:

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 项目文件夹中自动更新?

4

1 回答 1

0

由于在桌面启动项目文件夹更新的问题,图像文件和 JSON 文件不是直接从 Android 的资产自动复制到桌面的资产!如果出现此问题,我必须手动复制它。这是我能做的唯一最好的事情。从 Android assets 文件夹中,选择指定的文件和目录(文件夹)并将其复制到 Desktop 中的 assets 文件夹中。确保目录和文件名正确。

于 2013-04-11T01:38:53.817 回答