我正在尝试用云、山、树、峡谷等对象创建背景风景。一切都很顺利,除了当我创建云对象时。我已为云对象声明了,并将设置函数中var cloud
的坐标值初始化为。然而,当我尝试在下面提到的函数中创建具有椭圆形状的云对象时,它给我带来了两个问题:cloud
cloud = (pos_x: 200, pos_y: 70, diameter: 130);
draw()
cloud.pos_x
当我输入时,cloud.
我没有得到自动填充ellipse();
运行代码后出现错误*sketch.js:23 Uncaught Syntax Error: Unexpected token ':'*
(点彼此重叠)。
我希望我已经为您提供了足够的细节来理解这个问题。谢谢。
var floorPos_y;
var gameChar_x;
var gameChar_y;
var treePos_x;
var treePos_y;
var canyon;
var collectable;
var mountain;
var cloud;
var cloudPos_x:
var cloudPos_y;
var cloudDiameter;
function setup()
{
createCanvas(1024, 576);
floorPos_y = 432; //NB. we are now using a variable for the floor position
//NB. We are now using the built in variables height and width
gameChar_x = width/2;
gameChar_y = floorPos_y;
treePos_x = width/2;
treePos_y = height/2;
cloud = (pos_x: 200, pos_y: 70, diameter: 130);
}
慕盖茨4494581
相关分类