求助!黄金矿工的绳子和钩子应该怎么做呀!难哭了TAT
processing吧
全部回复
仅看楼主
level 1
Seveto2 楼主
在网上找的代码完全运行不了,自己找了好多资料,还是不会做
// 绳索与钩子class Rope {
PVector pos;
float angle, da;
float speed;
int state;
ArrayList<PVector> vertexs; Rope() {
pos=new PVector(0, 15);
state=0; // 绳索摇摆
speed=4;
da=0.025;
vertexs=new ArrayList<PVector>();
} // 摇摆
void shake() {
if (state==0)
angle+=da; if (angle>PI/2.5) {
angle=PI/2.5;
da=-da;
} else if (angle<-PI/2.5) {
angle=-PI/2.5;
da=-da;
}
} // 伸缩
void extend() {
if (state==1)
pos.y+=speed;
else if (state==2) {
pos.y-=speed;
if (pos.y<=15) {
miner.setFrameSequence(0, 3, 0);
state=0;
pos.y=15;
rope.speed=4;
}
}
} void show() {
shake(); // 摇摆
extend(); // 伸缩
pushMatrix();
translate(width/2-5, 80);
rotate(angle);
noStroke();
beginShape(QUADS);
texture(object3); // 绳索贴纸
vertex(-3, 0, 0, 0);
vertex(3, 0, object3.width, 0);
vertex(3, pos.y, object3.width, object3.height);
vertex(-3, pos.y, 0, object3.height);
endShape();
image(object2, 0, pos.y, 20, 20); // 钩子
popMatrix();
}
}
这是网上的代码
求助大神啊!
2018年12月19日 12点12分 1
level 7
Hello,这份代码是由我编写的。当时做的时候,我用上了贴图,这也可能是你程序运行不了的原因,缺少贴图的图片。但我在CSDN下载里面,附上了完整的文件,能够运行,你可以去找找。
2018年12月20日 00点12分 2
好的谢谢你!
2018年12月20日 09点12分
請問代碼怎麼被下架了
2023年04月28日 03点04分
1