有人知道为什么这段代码不起作用吗?我使用的是p5库,比如p5.play、p5.js.p5.声音、p5dominm或者类似的smth。这是一段代码:
class Player{
constructor(){
this.x,
this.y,
this.width,
this.height
}
if(keyPressed(d)) {
player.x=player.x+6;
distance=distance+0.5
}}
发布于 2022-03-02 20:46:51
创建类之后,需要创建类的实例。试着这样做:
class Player{
constructor(){
this.x,
this.y,
this.width,
this.height
}
const player = new Player();
if(keyPressed(d)) {
player.x=player.x+6;
distance=distance+0.5
}https://stackoverflow.com/questions/71328868
复制相似问题