关于processing的问题
本帖最后由 lonelyman 于 2016-4-16 18:19 编辑最近在学习使用AI_FOR 2D_gaming的库,但是在编译官网给出的源代码是报错,请大家帮忙看一下,错误出在哪里,谢谢!!!import game2dai.*;
import game2dai.entities.*;
import game2dai.entityshapes.*;
import game2dai.entityshapes.ps.*;
import game2dai.fsm.*;
import game2dai.graph.*;
import game2dai.maths.*;
import game2dai.steering.*;
import game2dai.utils.*;
World world;
StopWatch sw;
Vehicle tank;
Vector2D target = new Vector2D();
BitmapPic view;
public void setup() {
size(600, 320);
world = new World(width, height);
sw = new StopWatch();
// Create the mover
tank = new Vehicle(new Vector2D(width/2, height/2), // position
40, // collision radius
new Vector2D(0, 0), // velocity
40, // maximum speed
new Vector2D(1, 0), // heading
15, // mass
1.5f, // turning rate
1000 // max force
);
// What does this mover look like
view = new BitmapPic(this,"tanks.png", 8, 1, 0);
view.showHints(Hints.HINT_COLLISION | Hints.HINT_HEADING | Hints.HINT_VELOCITY);
tank.renderer(view);
// Finally we want to add this to our game domain
world.add(tank);
sw.reset();
}
public void draw() {
double elapsedTime = sw.getElapsedTime();
target.set(mouseX, mouseY);
tank.AP().arriveOn(target);
float speed = (float) tank.speed();
float maxSpeed = (float) tank.maxSpeed();
if (speed > 1) {
float newInterval = map(speed, 0, maxSpeed, 0.6, 0.04);
view.setAnimation(newInterval, 1);
}
else {
view.pauseAnimation();
}
world.update(elapsedTime);
background(218, 140, 54);
world.draw(elapsedTime);
}
以下是错误信息:d.pde:31:0:31:0: The constructor BitmapPic(d, String, int, int, int) is undefined game2dai这个库你没有吧。在Libraries里面找找看。 seagatecm 发表于 2016-4-12 00:41 static/image/common/back.gif
game2dai这个库你没有吧。在Libraries里面找找看。
我已经找到了AI_for_2d_gaming,但不知如何查看是否缺少game2dai这个库,请问我要如何查看 附上该库的下一级文件夹的截图 我知道为什么了,文档里面说明BitmapPic的构造函数只有4个参数。你给了5个。
Constructors
Constructor and Description
BitmapPic(PApplet papp, String fname)
Single image for all frames
BitmapPic(PApplet papp, String fname, int nCols, int nRows)
An animated image.
把后面的0去掉吧。
view = new BitmapPic(this,"tanks.png", 8, 1);
你可以在 菜单 帮助 - 库文件参考 里面看到这个帮助文档。 seagatecm 发表于 2016-4-16 13:19 static/image/common/back.gif
我知道为什么了,文档里面说明BitmapPic的构造函数只有4个参数。你给了5个。
Constructors
Constructor...
成功了,感谢大神的指导!!!
页:
[1]