【发布时间】:2021-10-22 15:13:27
【问题描述】:
我正在尝试获取玩家下方像素的颜色,如果它是蓝色的,我会阻止它们掉落。出于某种原因,它会检测到颜色,但即使匹配,if 语句也不会运行。这是代码:
gravity(){
if (this.y <= 400 - this.scale){
let gc = get(this.x, this.y + 25);
print(gc);
if (gc == [0, 0, 255, 255]){
this.canGravity = false;
}
else {
this.canGravity = true;
}
if (this.canGravity == true){
this.y += 2;
}
}
}
【问题讨论】:
标签: p5.js